Assignment:
Write a program that asks for the user's height. weight and age, and then computes clothing sizes according to the formulas:
Hat size = weight in pounds divided by height in inches and all that multiplied by 2.9.
jacket size(chest in inches)= height times weight divided by 288 and then adjusted by adding 1/8 of an inch for each 10 years over age 30. (note that adjustments only takes place after a full 10 years. so, there is no adjustment for ages 30 through 39, but 1/8 of an inch is added for age 40.)
waist in inches = weight divided by 5.7 and then adjusted by adding 1/10 of an inch for each 2 years over age 28. (note that the adjustment only 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.)
use functions for each calculation. your program should allow the user to repeat this calculation as often as the user wishes.
#include <iostream>
using namespace std;
double hat_size(double weight, double height);
double jacket_size(int age, double weight, double height);
double waist_size (int age, double weight, double height);
int main()
{
double weight,height;
int age;
char again;
cout << "Welcome to program sizes, this program calculates cloth sizes\n";
cout << "depending on Age, weight and height.\n";
do
{
cout << "Enter your age:\n";
cin >> age;
cout << endl;
cout << "Enter weight in pounds:\n";
cin >> weight;
cout << endl;
cout << "Enter your Height in Inches:\n";
cin >> height;
cout << endl;
cout << "Hat size: "<< hat_size(weight,height);
cout << endl;
cout << "Jacket size: "<< jacket_size(age,weight,height);
cout << endl;
cout << "Waist size: "<< waist_size(age,weight,height);
cout << endl;
cout << "Would you like to run program again?\n";
cout << "(y/n)\n";
cin >> again;
}while ((again == 'y')||(again == 'Y'));
cout << "<PROGRAM END>";
cout << endl << endl << endl << endl;
system ("pause");
return 0;
}
double hat_size(double weight,double height)
{
double hat_size;
hat_size = (weight/height)*2.9;
return hat_size;
}
double jacket_size(int age,double weight,double height)
{
double jacket_size;
jacket_size = (height * weight)/288;
if ((age > 30)&&(age % 10 == 0))
{
jacket_size = jacket_size + (1/8);
}
return jacket_size;
}
double waist_size(int age,double weight,double height)
{
double waist_size;
waist_size = weight/5.7;
if ((age > 28)&&(age % 2 == 0))
{
waist_size = waist_size + (1/10);
}
return waist_size;
}
Problem:
double jacket_size(int age,double weight,double height)
{
double jacket_size;
jacket_size = (height * weight)/288;
if ((age > 30)&&(age % 10 == 0))
{
jacket_size = jacket_size + (1/8);
}
return jacket_size;
}
double waist_size(int age,double weight,double height)
{
double waist_size;
waist_size = weight/5.7;
if ((age > 28)&&(age % 2 == 0))
{
waist_size = waist_size + (1/10);
}
return waist_size;
}
can somebody please help.. My program is absolutely screwd up b/c of the problem. this is very confusing and i have tried everything.. all i can think of doing it this way. But the way doesnt work.. If statements wont do b/c it says "per" 10..

New Topic/Question
Reply





MultiQuote




|