# Estimating the adult height of a child

• February 8th, 2012, 06:00 PM
ep7network
Estimating the adult height of a child
I am trying to write a program that takes as input the gender of a child, the height of the mother in inches, and the height of the father in inches, and outputs the estimated adult height of the child in inches. I think I have to use a loop, but not sure. Also getting illegal start type error's and cannot find symbol errors. Here is what I have so far

package labassignment3;
/**
*
* @author Edgar
*/
import java.util.Scanner;

public class LabAssignment3 {
public static void main(String[] args) {
String line;
Scanner keyboard = new Scanner(System.in);

System.out.println("Enter the gender of your child:");
line = keyboard.nextLine();
System.out.println("Enter your mother's height in inches:");
line = keyboard.nextLine();
System.out.println("Enter the height of your father in inches:");
line = keyboard.nextLine();
//System.exit(0);
int maleChild = 0;
int femaleChild = 0;
int H_Mother = 0;
int H_Father = 0;

// This is the mathmatical formula for a male child
//maleChild =((H_Mother * 13/12)+ H_Father)/2;
//This is the formula for female child
//femaleChild = ((H_Father * 12/13)+ H_Mother)/2;
}
if (keyboard.nextLine == female)
System.out.println("Enter the height of your father in inches:");
System.out.println("Enter your mother's height in inches:");

else
{
(keyboard.nextLine == male)
System.out.println("Enter your mother's height in inches:");
System.out.println("Enter the height of your father in inches:");
System.out.println(((H_Mother * 13/12)+ H_Father)/2);
}
}
• February 8th, 2012, 07:12 PM
Norm
Re: Estimating the adult height of a child
Please post the full text of the error messages.

When posting code, please wrap it in code tags.