## CSCI 1300 - Programming Assignment 1B Body Mass Index Due Tuesday, Sep 3 at 9:30am

Homework Policy
For this assignment, you may consult with other students and look at their work if it will help you understand. For this assignment, you may even work in groups and trade solutions back and forth provided that you acknowledge your entire group in a comment at the top of the program.

We will have other assignments that you will be asked to do entirely on your own.

### Body Mass Index

The purpose of Assignment 1B is to make sure that you know how to write a small program that reads some information, does a calculation, and prints results that are based on that calculation.

Write a short program called bmi.cxx to calculate a person's "body mass index" as described below.

Input. The program asks the user for these pieces of information:

2. Your height in feet and inches (two separate input numbers)
The program must prompt for these items and read them in the order listed above.

Output. The program then prints messages with this information:

1. The person's weight in kilograms, rounded to two decimal places (as shown on page 31 of the text). (Information for the calculation: There are 0.45359237 kg per pound.)
2. The person's height in centimeters, rounded to one decimal place. (Information for the calculation: There are 2.54 cm per inch.)
3. The person's metric body mass index, rounded to one decimal place. This is calculated as:

10,000 × (weight in kg) ÷ (height in cm)²

Note:There is a "division" symbol in the middle of the above formula and a "square" symbol at the end.

4. A message about the person's height. The message must be one of these:
• If the height is more than 215 cm: ```Budge up, yeh great giant, you be taller than Hagrid.```
• If the height is less than 7 cm: ```You do look a great deal like a mouse.```
• Otherwise: ` You are a fugitive from the law of averages.`
In order to print the message in the last step, you'll need to use a feature of C++ that is not part of the assigned reading. I'll talk about this feature (if-statements) in class on Thursday. The only numbers in the output should be the three numbers listed above, and these numbers must be in the order: weight, height, BMI. Otherwise, you'll confuse Dora.

Documentation.

```/*****************************************************************
* The program must have a comment at the top, in this exact form.
* The comment must contain the same items as Assignment 1A.
*****************************************************************/
```

Check that the program compiles and runs correctly. Submit the program to Dora and check the results a few minutes later.

• Late work accepted with penalty: through end of Wednesday, Sep 4
• No work accepted after Sep 4.