need to get the rmr
Im getting the wrong answer when I run the program.
If I input the numbers found in thie image, http://tinyrealm.com/~efa/cisc2305/pics/rmr.jpg
I get a different answer on my program than the other program in the image.
********************************
* RMR = (9.99w + 6.25s) - 4.92a + 166g
* w = weight in kilograms; if you know your weight in pounds,
divide by 2.2 to get your weight in kilograms
* s = height in centimeters; if you know your height in inches,
multiply by 2.54 to get your height in centimeters
* a = age in years
* g = gender = 1 for males, 0 for females
********************************
//my equation so far
((((9.99 * wk) + (6.25 * hc)) - (4.92 * ageyears) + gender)) //wk is weight in kilograms aka w
//hc is height in centimeters aka s
//height in Centimeters so far
hc = (float)(((heightfeet * 12) * 2.54) + (heightinch * 2.54));
//weight in Kilograms so far
wk = (float)((weightpounds) / (2.2));
source code for visual c#
[SOLVED] Need a little help with my equation....
Moderator: Coders of Rage
[SOLVED] Need a little help with my equation....
Last edited by Keevu on Sun Mar 29, 2009 11:28 pm, edited 3 times in total.
- ismetteren
- Chaos Rift Junior
- Posts: 276
- Joined: Mon Jul 21, 2008 4:13 pm
Re: Need a little help with my equation....
either i am lacking math skills(or actually, i know i am) or you havent told what the actual problem is.
Re: Need a little help with my equation....
Im getting the wrong answer if I input the same numbers in this image http://tinyrealm.com/~efa/cisc2305/pics/rmr.jpgismetteren wrote:either i am lacking math skills(or actually, i know i am) or you havent told what the actual problem is.
I cant figure out where I went wrong I looked over it many times.
Re: Need a little help with my equation....
Quick debug show that heightinch is 5, when it should be 9, which leads to:
Which should be textBox5.
On a side note, IMHO, you're doing way too much in a single statement. Try splitting them more up, easier to see what's going on.
Make a function that converts feet to cm, and same for inches to cm. And shouldn't you be converting the "result" variable instead of calculating it again? (if it isn't a debug-leftover.. )
Code: Select all
heightinch = float.Parse(textBox1.Text);
On a side note, IMHO, you're doing way too much in a single statement. Try splitting them more up, easier to see what's going on.
Make a function that converts feet to cm, and same for inches to cm. And shouldn't you be converting the "result" variable instead of calculating it again? (if it isn't a debug-leftover.. )
Re: Need a little help with my equation....
it works I cant believe i didnt see that.Which should be textBox5.Code: Select all
heightinch = float.Parse(textBox1.Text);