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

using c++ Write a program that reads from a file the customer number, height (in

ID: 3572101 • Letter: U

Question

using c++

Write a program that reads from a file the customer number, height (in inches), weight and age of 10 individuals. This program then computes clothing sizes for each individual based on the following formulas.

Hat size = weight in pounds divided by height in inches and all that multiplied by 2.9

Jacket size = height times weight divided by 288 and then adjusted by adding 1/8 of an inch for each 10 years over age 30. (NOTE: the adjustment only takes place after a full 10 years. So, there is no adjustment for ages 30 through 39, but 1/8th of an inch is added for age 40, and so on). Do not use nested if statements for this.

Pant size = weight divided by 5.7 and then adjusted by adding 1/10th of an inch for each 2 years over age 28. (NOTE: the adjustment only takes place after a full 2 years. So, there is no adjustment for age 29, but 1/10th of an inch is added for age 30 and so on). Do not use nested if statements for this.

Use function for each calculation, as well as a function to read in the data from a file and a function to print the results to an output file.

Input File

120   77   210   40
121   70   185   45
122   68   170   51  
123   72   200   31
124   70   210   63
125   72   189   29
126   70   220   42  
127   75   250   25
128   66   150   39
129   72   150   22

Output File should have the following:
Page heading
Column headings
Columns for id, height, weight, age, hat size, jacket size, and pant size.

Explanation / Answer

#include <iostream>

using namespace std;

double hat(double,double);

double jacket(double,double,int);

double waist(double,double,int);

int main ()

{

double height, weight;

int age;

char answer;

cout.setf(ios::fixed);

cout.setf(ios::showpoint);

cout.precision(2);

do

{

cout<< "Enter the user's height in inches: ";

cin>>height;

cout<< "Enter the user's' weight in pounds: ";

cin>>weight;

cout<< "Enter the user's' age: ";

cin>>age;

cout<< " The user's Hat size: " << hat(weight ,height) << " The user's Jacket size: "<< jacket( height, weight, age) << " The user's Waist size: "<< waist( height, weight, age)<< " Would you like to continue (y/n)? ";

cin>>answer;

}

while(toupper(answer) == 'Y');

return 0;

}

double hat(double weightInPounds, double heightInInches);

{

return weight / height * 2.9;

}

double jacket(double heightInInches, double weightInPounds,int age)

{

double size;

int j;

if (age>=30)

{

if((age % 10) !=0)

age = age-(age%10);

j= (age-30)/10;

size =((height * weight) / 288)+((1.0/8)*j);

}

else

size =((height * weight) / 288);

return size;

}

double waist(double heightInInches, double weightInPounds, int age)

{

double size2;

int k;

if(age >= 28)

{

if((age % 2) !=0)

age = age-(age%2);

k = (age-28)/2;

size2 = (weight/(5.7))+( (1.0/10)*k);

}

else

size2 = weight / (5.7);

return size2;

}