CS201
Lab #2
Due by Midnight, 9/17

Height Predictor

One way to estimate the adult height of a child is to use the following formula, which uses the height of the parents:

Hmale_child = ((Hmother * 13 / 12) + Hfather) / 2
Hfemale_child = ((Hfather * 12 / 13) + Hmother) / 2

All heights are in inches. 

Write a program that takes as input the gender of the child (either 'M' or 'F'), 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.  Use an if-then-else statement to determine which equation should be used depending on the gender. Read in the gender using the .next() method of the Scanner class. You can access the first character using charAt(). For example:

  Scanner keyboard = new Scanner(System.in);
  System.out.println("Enter 'M' or 'F'.");
  String s = keyboard.next(); 	// Read in character
  char firstLetter = s.charAt(0);

Environment:  You are free to use any Java environment you wish (e.g. pico on bigmazzy, TextPad, NetBeans...)

To turn in:   Either show your working program to your instructor during the class lab session for credit, or upload your Java code tto blackboard.