I am trying to create a program that will estimate a child height based on the height of the parents.
It should ask the user to enter a String representing the gender, so m or M for a male and f or F for a female. The program must handle both upper or lower case gender entries.
I need it to ask the user for the height of both parents in two parts
1. for Feet and store in an int variable.
2. for inches and store and int variable.
So for example if the father is 6' 2'', the user would enter 6 when asked for feet and 2 when asked for inches.
Convert the height of the each parent to inches. hint 12" in one foot.
Apply the following formulas based on gender (must use an if statement(s)):
Hmale_child = ((Hmother * 13/12) + Hfather)/2
Hfemale_child = ((Hfather * 13/12) + Hmother)/2
I cannot figure out what is missing from my code
<import java.util.Scanner; public class ChildHeight { public static void main(String[] args) { Scanner scannerObject = new Scanner(System.in); String gender; String male; String female; int Hmother = 0, Hfather = 0; int Hmale_child, Hfemale_child; int motherFeet, motherInches; int fatherFeet, fatherInches; System.out.println("Please enter the gender of the child, indicate M for male, F for female"); gender = scannerObject.nextLine(); System.out.println("Enter height of the mother in feet " + " height of the mother in inches"); motherFeet = scannerObject.nextInt(); motherInches = scannerObject.nextInt(); System.out.println("Enter height of the father in feet " + " height of the father in inches"); fatherFeet = scannerObject.nextInt(); fatherInches = scannerObject.nextInt(); // this is the formulas based on gender // Hmale_child = ((Hmother * 13/12) + Hfather)/2 // Hfemale_child = ((Hfather * 13/12) + Hmother)/2 if (gender.equals("male")) { System.out.println("Height of male child: " +((Hmother*(13/12)) + Hfather)/2); } else { System.out.println("Height of female child: " +((Hfather*(12/13)) + Hmother)/2); } System.out.println("The estimated height of the child is: ") ; } }>