Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

FIRST person to answer this correctly will receive total points. One way to esti

ID: 3542674 • Letter: F

Question

FIRST person to answer this correctly will receive total points.


One way to estimate the 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 function 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. Embed your function in a

program that allows you to test the function over and over again until telling the

program to exit. The user should be able to input the heights in feet and inches,

and the program should output the estimated height of the child in feet and inches.

Use the integer data type to store the heights.

FIRST person to answer this correctly will receive total points. One way to estimate the height of a child is to use the following formula, which uses the height of the parents:

Explanation / Answer

#include<iostream>
using namespace std;
int hieght_of_child(char gender,int Hmother,int Hfather)
{
switch(gender)
{
case 'M':
case 'm': return ((Hmother*13/12)+Hfather)/2;
case 'F':
case 'f': return ((Hfather*12/13)+Hmother)/2;
default: cout << "Invalid Gender Found" << endl;
}
return 0;
}
int main()
{
char ans = 'y';
int mother_feet,mother_inch;
int father_feet,father_inch;
char gender;
while(ans=='y' || ans =='Y')
{
cout << "Enter Mother Height in feet and inches :" << endl;
cin >> mother_feet >> mother_inch;
cout << endl;
cout << "Enter Father Height in feet and inches :" << endl;
cin >> father_feet >> father_inch;
cout << endl;
cout << "Enter Gender of child :" << endl;
cin >> gender;
cout << endl;
// convert feet to inch by multiplying feet with 12.
cout <<"Expected Height of child given by " << hieght_of_child(gender,mother_feet*12+mother_inch,father_feet*12+father_inch) << endl;
cout<< "Do you want to continue (Y or N) ";
cin >> ans;
cout << endl;
}
return 0;
}