Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Computer Program that computes the Body Mass Index (BMI) of a person knowing the persons height in inches, weight in pounds. The user

  1. Write a Computer Program that computes the Body Mass Index (BMI) of a person knowing the persons height in inches, weight in pounds. The user inputs the height and weight. Then the program checks if the height and weight are non-negative, or 0, if so, then the program immediately gives an error message and ask the user to enter these again.

The BMI is computed as below:

BMI = BMI_CONSTANT * weight / height2

Where BMI_CONSTANT is defined as a constant whose value is 703

Once the BMI is computed, display the BMI value rounded up to nearest integer. Also, check the value of BMI and display the following message depending on the value.

If BMI is less than 20, display underweight, have a milk shake

If BMI is more than or equal to 20, but less than or equal to 25, display, Normal, have a glass of milk.

If BMI is higher than 25, but less than or equal to 30, then display Overweight, have a glass of ice tea.

If BMI is higher than 30, display Obese, see your doctor.

The rounding to nearby integer can be done, by using the round(BMI) , need to include cmath.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions

Question

In what ways do the techniques of mediation and arbitration differ?

Answered: 1 week ago