Making-a-Difference Exercises

  1. 3.31 (Body Mass Index Calculator) We introduced the body mass index (BMI) calculator in Exercise 1.27. The formulas for calculating the BMI are

    BMI=weightInPounds×703heightInInches × heightInInches

    or

    BMI=weightInKilogramsheightInMeters × heightInMeters

    Create a BMI calculator app that reads the user’s weight in pounds and height in inches (or, if you prefer, the user’s weight in kilograms and height in meters), then calculates and displays the user’s body mass index. The app should also display the following information from the Department of Health and Human Services/National Institutes of Health so the user can evaluate his/her BMI:

    
    BMI VALUES
    Underweight:  less than 18.5
    Normal:       between 18.5 and 24.9
    Overweight:   between 25 and 29.9
    Obese:        30 or greater
    
  2. 3.32 (Car-Pool Savings Calculator) Research several car-pooling websites. Create an app that calculates your daily driving cost, so that you can estimate how much money could be saved by car pooling, which also has other advantages such as reducing carbon emissions and reducing traffic congestion. The app should input the following information and display the user’s cost per day of driving to work:

    1. Total miles driven per day.

    2. Cost per gallon of gasoline (in cents).

    3. Average miles per gallon.

    4. Parking fees per day (in cents).

    5. Tolls per day (in cents).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset