Question: This is the question This is the code i got so far, the answers aren't correct when the code is being run. I need help

This is the question

This is the question This is the code i got so far,

This is the code i got so far, the answers aren't correct when the code is being run. I need help in fixing it so it gives the correct answer. Use test value of Gender = m, height of father = 75, and height of mother = 70. Then check if it gives the correct answer.

The Programming language is ADA!

with Ada.Text_IO; use Ada.Text_IO;

with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;

procedure Variables is

-- varable declarations

My_Char : CHARACTER;

male : CHARACTER := 'M';

unitm : CHARACTER:= 'c';

female : CHARACTER := 'F';

father_height: Integer;

mother_height: Integer;

child_height: Integer;

child_height_feet: Integer;

child_height_cm: Float;

--Main program

begin

Put ("Enter the gender of the child (M/F): "); -- gets the child's gender

Get (My_Char);

Put_Line("");

Put ("Enter height of father: "); -- gets the height of father

Get (father_height);

Put_Line("");

Put ("Enter height of mother: ");

Get (mother_height);

Put_Line("");

if My_Char = male then -- If condition to assertain which calcualation to go with since the calcualtion of the male and female child's height are different

child_height := ((mother_height*15/12)+father_height)/2;

end if;

if My_Char = female then

child_height := ((father_height*14/13)+mother_height)/2;

end if;

-- Output of the Child's expected height in inches, feet and centimeter

Put ("child's expected height in inches is: ");

Put (child_height);

Put_Line("");

child_height_feet := child_height / 12;

Put ("child's expected height in feet is: ");

Put (child_height_feet);

Put_Line("");

child_height_cm := Float(child_height) / 0.393701;

Put ("child's expected height in feet Centimeter is: ");

Put (Integer(child_height_cm));

end Variables;

Project description: Implement the following functions in Ada programming language: One way to estimate the height of a child is to use the following formula, which uses the height of the parents: For male child: HChild=((Hmother * 15/12) + Hfathery/2 For female child: HChild=c(Hfather * 14/13)+Hmother)/2 All heights are in inches. Write a program that takes as input parameters the gender of the child, height of the mother in inches, and height of the father in inches, and outputs the estimated height of the child in inches. The user should be able to input the heights in inches, feet or centimeters, and the program should output the estimated height of the child in inches, feet and in centimeters. Use the integer data type to store the heights. 1 cm = 0.393701 inches 1 feet = 12 inches

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!