Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

Students also viewed these Databases questions

Question

What are the functions of sleeppg12

Answered: 1 week ago

Question

What is its communication style and the preferred channels?

Answered: 1 week ago