How to make it understand this?

It said to
height times eight divided by 288 and
add 1/8 of an in for each 10 years over 30.
so like on 40, 50, 60...etc
Sorry.... what!?
I second that.
the question i have to answer with a program said to take the
height times eight divided by 288 to get a persons jacket size.
Then take the persons age and for ever 10 yrs over 30 add an 1/8 of an inch to the jacket size.
I dont know how to make the computer understand to only add an 1/8 if the person is 40, 50 ....etc
Well, a cheap, bad solution is:

1
2
3
4
5
if( age > 120 ) // not supporting anyone older than 129, sorry...
   height = height + 8 * (1.0/8.0);
else if( age > 110 )
   height = height + 7 * (1.0/8.0);
// etc... 


I'll leave it up to you to optimize this.

In the formula x * (1.0/8.0) you can easily express x in terms
of age if you think about it a bit.
so im pretty slow at this but how would it understand that they numbers it needed were 40, or 50 exactly?
so im pretty slow at this but how would it understand that they numbers it needed were 40, or 50 exactly?
think about it a bit.
Topic archived. No new replies allowed.