NEED HELP PROGRAM DUE IN LIKE 10-15 minutes

I dont understand how to fix the problem but i know where the problem

Page 1 of 1

5 Replies - 1025 Views - Last Post: 06 November 2009 - 10:27 PM Rate Topic: *---- 1 Votes

#1 AhmerjavedC++  Icon User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 253
  • Joined: 02-October 09

NEED HELP PROGRAM DUE IN LIKE 10-15 minutes

Posted 06 November 2009 - 09:45 PM

Assignment:

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..

Is This A Good Question/Topic? 0
  • +

Replies To: NEED HELP PROGRAM DUE IN LIKE 10-15 minutes

#2 penguin2  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 88
  • Joined: 22-July 08

Re: NEED HELP PROGRAM DUE IN LIKE 10-15 minutes

Posted 06 November 2009 - 10:15 PM

Would you post your error if it isn't too late?
Was This Post Helpful? 0
  • +
  • -

#3 aks29921  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 84
  • View blog
  • Posts: 230
  • Joined: 24-August 09

Re: NEED HELP PROGRAM DUE IN LIKE 10-15 minutes

Posted 06 November 2009 - 10:15 PM

you are not calculating the jacket size and waist size correctly...

here's what should be done for waist size:
if (age>29)
waist_size=waist_size+.1*(age-28)/2;
judging from the description you gave...

similarly for jacket size..

hope this helps

This post has been edited by aks29921: 06 November 2009 - 10:18 PM

Was This Post Helpful? 0
  • +
  • -

#4 AhmerjavedC++  Icon User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 253
  • Joined: 02-October 09

Re: NEED HELP PROGRAM DUE IN LIKE 10-15 minutes

Posted 06 November 2009 - 10:18 PM

View Postpenguin2, on 6 Nov, 2009 - 09:15 PM, said:

Would you post your error if it isn't too late?



i can still post it. i have the page where i upload it open

View Postaks29921, on 6 Nov, 2009 - 09:15 PM, said:

you are not calculating the jacket size and waist size correctly...

here's what should be done for waist size:
waist_size=waist_size+.1*(age-28)/2;
judging from the description you gave...

similarly for jacket size..

hope this helps


it only applys if the person is older than 28

This post has been edited by AhmerjavedC++: 06 November 2009 - 10:29 PM

Was This Post Helpful? 0
  • +
  • -

#5 aks29921  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 84
  • View blog
  • Posts: 230
  • Joined: 24-August 09

Re: NEED HELP PROGRAM DUE IN LIKE 10-15 minutes

Posted 06 November 2009 - 10:20 PM

View PostAhmerjavedC++, on 6 Nov, 2009 - 09:18 PM, said:

View Postpenguin2, on 6 Nov, 2009 - 09:15 PM, said:

Would you post your error if it isn't too late?



i can still post it. i have the page where u uploaded open

View Postaks29921, on 6 Nov, 2009 - 09:15 PM, said:

you are not calculating the jacket size and waist size correctly...

here's what should be done for waist size:
waist_size=waist_size+.1*(age-28)/2;
judging from the description you gave...

similarly for jacket size..

hope this helps


it only applys if the person is older than 28

just edited my above post to add the if condition, take a look at it again
Was This Post Helpful? 0
  • +
  • -

#6 AhmerjavedC++  Icon User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 253
  • Joined: 02-October 09

Re: NEED HELP PROGRAM DUE IN LIKE 10-15 minutes

Posted 06 November 2009 - 10:27 PM

I can still upload code.. I have to just reloading that darn page.. so it would not look like i handed this in late.. FYI.. this is a high school honors class. just letting u guys know

View Postaks29921, on 6 Nov, 2009 - 09:20 PM, said:

View PostAhmerjavedC++, on 6 Nov, 2009 - 09:18 PM, said:

View Postpenguin2, on 6 Nov, 2009 - 09:15 PM, said:

Would you post your error if it isn't too late?



i can still post it. i have the page where u uploaded open

View Postaks29921, on 6 Nov, 2009 - 09:15 PM, said:

you are not calculating the jacket size and waist size correctly...

here's what should be done for waist size:
waist_size=waist_size+.1*(age-28)/2;
judging from the description you gave...

similarly for jacket size..

hope this helps


it only applys if the person is older than 28

just edited my above post to add the if condition, take a look at it again


it has to do it every 2yrs. 30 then 32 and 34.. which is the annyoning part that i dont get how to solve


All week i have tried many diffrent ways and i dont get it how to fix the error!.. I changed them to if statements and every thing
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1