i'm facing problem with my calculation where the output did not match with the manual calculation.
Your height and weight variables got crossed when you loaded them from the text boxes.
Look closely.
P.s. you are not the first person to post BMI code here
Pps. You could have avoided this by extending your variable names with units of measure, like heightCM and weightKG. Having variable names differ by only a single letter is begging for trouble.
Hello, sorry I'm a beginner at coding. Can you take a look at which part I have a problem here ? . My BMI calculation is okay, but the calculation of total calories is not like the manual. Based on the output of the picture, I got 1686, it should be 1299 kcal/day. I just want round number to be the output. help meee
TDEE=[(10×40)+(6.25×155)−(5×25)−161]×1.2=1299.3 kcal/day
here's the file
BMI_and_Calories (1).aia (508.4 KB)
(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.
A double negative is a positive.
At the end of the bmr formula for women, you nest the -161 too deeply, putting it inside something that is being subtracted.
That turns it into a +161, causing your bmr to be too high by 1.2 * 161 * 2
Use the blue mutator button to add sockets to the + block.
You need a four socket + block.
Use the math negative block to negate the third and fourth inputs.
Use the right click external sockets block option to expose the tree structure of each formula to help make the nesting easier to track.
Here's a sample run.
I had to adjust a few text box flags. Instead of Numbers Only, you had them set to Read Only, the adjacent attribute in the Designer. That was baffling during testing.
After switching block inputs, you has
After fixing the bmr formula, it is
Test run:
I had to increase font size on the calories to make it readable by me.
By the way, this is hilarious:
BMI_and_Calories1 (1).aia (508.9 KB)
You might have to double check a sample run with the Male option. I don't know if its factor should be +5 or -5.
Thank you for the guidance.I learn a lot of new things from it.
i never knew that we could add the neg blocks.i thought we could just simply do the calculation from the back to front. it was very confusing.
i didnt know why the text was changed to readonly, it was fine before i uploaded here. thank you pointing that out.
about the purple blocks, it was unintentional.