HW 9

Extra Credit problems

in-class section: due 5/31 (by midnight)
DL section: due 6/1 (by midnight)

We talked about conditionals (chapter 11), timed events (setTimeout, setInverval) and algorithms (chapter 8). Next week, we'll talk about repetition.

The exercises on this homework are all extra credit (remember extra credit points don't count 1:1 like regular homework points; I use extra credit points to move you up in the grading scheme at the end).

1. [Extra Credit: Random Coin Toss, 10pt] Extend your random coin toss page from homework 8 to include percentages of heads and tails seen.

2. [Extra Credit: BMI calculator, 20pt] Implement a calculator that computes your body-mass index (BMI). The formula for the BMI is as follows:

    BMI = 703 * weight /  height2

where the weight is measured in pounds and the height in inches. The user should be able to enter their body weight in pounds, and their height using two input boxes (one for feet, one for inches, e.g., you'd enter 5 in the feet input box and 10 in the height input box to say 5'10''). The output of the page should be your numerical BMI together with the category you fall in (according to NIH, this is a simplified table, ignoring age):

  • Underweight = <18.5
  • Normal weight = 18.5-24.9
  • Overweight = 25-29.9
  • Obesity = BMI of 30 or greater

3. [Extra Credit: Asteriods; this is hard] Extend the simple asteroids game we saw in class as follows:

Marcus Schaefer
Last updated: May 27th, 2006.