/*
* Java program that prompts user to enter the feet and inches
* of father and mother of a child and then prompts for the
* gender m or f then find the height of the child in feet
* and inches
* */
import java.util.Scanner;
public class EstimatedHeight
{
public static void main(String[] args)
{
//declare varialbles
int father_height;
int mother_height;
int child_height;
int child_height_feet;
int child_height_inches;
String gender="";
Scanner console=new
Scanner(System.in);
//read input data values from
user
System.out.printf("Enter height of
father (in feet) : ");
int father_height_feet =
Integer.parseInt(console.nextLine());
System.out.printf("Enter height of
father (in inches) : ");
int father_height_inches =
Integer.parseInt(console.nextLine());
System.out.printf("Enter height
of mother (in feet) : ");
int mother_height_feet =
Integer.parseInt(console.nextLine());
System.out.printf("Enter height of
mother (in inches) : ");
int mother_height_inches =
Integer.parseInt(console.nextLine());
System.out.printf("Enter Gender(m
or f ):");
gender=console.nextLine();
//calculate the father height in
inches
father_height=12*father_height_feet+father_height_inches;
//calculate the mother height in
inches
mother_height=12*mother_height_feet+mother_height_inches;
//calculate the height of the
child in inches
if(gender.equalsIgnoreCase("m"))
child_height=((mother_height*13/12)+father_height)/2;
else
child_height=((mother_height*12/13)+father_height)/2;
//conver the child height in
feet and inches
child_height_feet=child_height/12;
child_height_inches=child_height%12;
//print the child height in feet
and inches
System.out.printf("Height of child
: %d\" %d\' \n",
child_height_feet,child_height_inches);
} //end of the method
}//end of the class
sample output:
Outputs of given sample values as test cases
(JAVA) Project 2: Predicting A Child's Height (10 pts). One way to estimate the adult height...
JAVA Using the data provided in the attachment, create a program that will display a child's predicted adult height. This program will need to create an array of objects to search. This program needs to validate the input for valid range and input values. If invalid data is given, the program needs to indicate that data is invalid and suggest appropriate values/ranges. However, you do not need to validate alphabetic data given for numeric input. 1. The program will need...