xv

AppleScript of the Day: Calculate BMI and weight-loss goal.

Jul 29, 2011 19:49

This is a simple script that uses the Body Mass Index equation I found on this Wikipedia page. I got a chance to use my nifty College Algebra skills to re-write the equation so it would calculate how much weight one has to lose or gain to achieve normal weight. Normal weight in this case is not defined by a range as it should be, but rather a BMI of precisely 24.9, or the fattest you can be and still be considered normal.

I didn't want to bother with dialog boxes, so you have to enter your height manually, and look in the results window for the result. This should be fairly obvious, but if you need help, the first line reads:

set {f, i, w} to {5, 9.5, 195}

...which means that I am 5 feet, 9-and-a-half inches tall, and weigh 195 pounds. When you run this, the result is "Your BMI is 28. You are overweight, just like over half the American population. You need to lose 24 pounds to become normal weight."

math, applescript

Previous post Next post
Up