can i do this some other way?
Some info, im trying to find a users jacket size depending on their heigh, weight and age, the algorithm is simple.
(height * weight)/ 288.
But here is the tricky part, if the person is above age 30 then the jacket size should be adjusted by 0.125 for every 10 years. So if the user is 35, there will be no adjustments, but if the user is 40 then 0.125 will be added to the jacket size if the user is 50 then 0.125 + 0.125=0.250 will be add to the jacket size and so on.
my function does that, but i feel that im making complicated calculations and that there must be some easier way or cleaner way to do it.
//function to compute jacket size
double jacketsize(double height, double weight, int age)
float adjust =0.125;
if (age <40)
jacket= (height * weight) /288;
else if (age>=40)
count = (age - 30)/10;
jacket= ((height * weight) /288) + (count * adjust);