Collin Sampson wrote:How is the input not an integer though?
Since you didn't show the input or the error, it's impossible to say for sure. All we can say for sure is that it didn't meet the criteria of consisting of nothing but digits, optionally with a leading minus sign, and representing a number within int's range.
I am asking for two whole numbers, feet first then inches. When I replace '12' with 12.0, I get an error: "loss of precision".
The "loss of precision" error is telling you just what it sounds like: If you try to stick a double value into an int variable, you will lose some precision. That is, it will not be as precise. So, for instance, 12.0, 12.1, and 12.999 will all become just 12.
You could do just use a double variable as soon as you read it:
an int expression on the RHS of = will automatically get promoted to a double on assignment.
Or you could cast your int variable to a double when the calculation time comes:
The output is wrong because if I input '10' then '0' for height of both parents it ouputs that the height of the male child will be 10 feet and 0 inches. The correct answer should be 10 feet and 5 inches roughly.
That may be a side effect of you losing precision in your int division. Fix that first and then see where you stand.