Professional Documents
Culture Documents
Java Assaignment
Java Assaignment
南京信息工程大学
Assignment
Input code:
Output:
2.14
(Health application: computing BMI) Body Mass Index (BMI) is a measure of health
on weight. It can be calculated by taking your weight in kilograms and dividing by
the square of your height in meters. Write a program that prompts the user to enter
a weight in pounds and height in inches and displays the BMI. Note that one pound
is 0.45359237 kilograms and one inch is 0.0254 meters
Input code:
Output:
2.22
(Financial application: monetary units) Rewrite Listing 2.10, ComputeChange .java,
to fix the possible loss of accuracy when converting a double value to an int value.
Enter the input as an integer whose last two digits represent the cents. For
example, the input 1156 represents 11 dollars and 56 cents.
Input code:
Output: