Hello:
I would like for the following code to calculate the following (see below code):
This program should calculate the hat, jacket and waist sizes based on the (any)values you enter.
I have completed the code but, its not calculating the correct output.
THANK YOU IN ADVANCE!
Given:
Note:
Please enter 'y' if you would like to try this again. Your program should allow the user to repeat this calculation as many times as he wants.
(Hint: First get your program to work once and then add a loop in main)
CODE:
I would like for the following code to calculate the following (see below code):
This program should calculate the hat, jacket and waist sizes based on the (any)values you enter.
I have completed the code but, its not calculating the correct output.
THANK YOU IN ADVANCE!
Given:
- Hat size the weight in pounds divided by the height in inches and then all that is multiplied by 2.9
- Jacket size (chest in inches) the height (in inches) times the weight is divided by 288 and then adjusted by adding 1/8 of an inch for each 10 years over age 30. (Note that the adjustment only takes place after a full 10 years. So there is no adjustment for ages 30-39, but 1/8 is added for age 40 and another 1/8 is added, if hes at least 50, etc.)
- Waist in inches- the weight divided by 5.7 and then adjusted by adding 1/10 of an inch for each 2 years over age 28. (Note the adjustment takes place after a full 2 years. So there is no adjustment for age 29, but 1/10 of an inch is added for age 30, etc)
Note:
Please enter 'y' if you would like to try this again. Your program should allow the user to repeat this calculation as many times as he wants.
(Hint: First get your program to work once and then add a loop in main)
CODE:
Rich (BB code):
#include<iostream>
using namespace std;
int main()
{
double weight,height,age;
double totalhatsize,totalJacketsize,totalwaist;
double Hatsize=(weight/height)*(2.9);
double adjustment = age>39?(age-10)/0.1: 0;
double Jacketsize = ((height*weight)/288)+ adjustment/0.125;
double adjustment2 = age>29?(age-28)/2: 0;
double waist = ((weight/5.7) + adjustment2/0.1);
char choice;
do
{
cout<<"Enter your Height\n";
cin>>height;
cout<<"Enter your Weight\n";
cin>>weight;
cout<<"Enter your Age\n";
cin>>age;
totalhatsize =(weight,height);
totalJacketsize =(weight,height,age);
totalwaist =(weight,age);
cout<<"totalhatsize"<<totalhatsize<<"\n";
cout<<"totalJacketsize"<<totalJacketsize<<"\n";
cout<<"totalwaist"<<totalwaist<<"\n";
cout<<"To repeat calculation press'y'\n";
cin>>choice;
}
while
(choice == 'y' || choice == 'y');
return 0;
}