CSI 1390
Assignment 2
Due date: 24 Oct
2006
Question 1
A quantity known as body mass index (BMI) is used to calculate the risk of weight-related health problems. BMI is computed by the formula:
BMI = w/h2
wher w is weight in kilograms and h is height in meters. A BMI of about 20 to 25 is considered "normal". Write a Java program that accepts the weight and height (both integers) and outputs the BMI.
Question 2
Your weight is actuallly the amount of gravitational attraction exerted on you by the earth. Since the moon’s gravity is only 1/6 of the earth’s gravity, on the moon you would weigh only 1/6 of what weigh on the earth.
Write a Java program that inputs the user’s weight and outputs his/her weight on Mercury. Venus, Jupiter, and Saturn. Use the values in the table below:
|
Planet |
Multiply the earth weight by |
|
Mercury |
0.4 |
|
Venus |
0.9 |
|
Jupiter |
2.5 |
|
Saturn |
1.1 |
|
|
|