Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

Members have full access to the forums. Advertisements are removed for registered users.

# Thread: Estimating the adult height of a child

1. ## 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);
}
}

2. ## 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.
Edit your post and wrap your code with[code=java]<YOUR CODE HERE>[/code] to get highlighting