# Introduction to Computer Programming, 2005 by gregorio11

VIEWS: 30 PAGES: 2

• pg 1
```									                    Introduction to Computer Programming, 2005

Program Assignment Ⅱ
2005/10/4

Scope: Chapter 2 & chapter 3 in Textbook (if, if…else and while statement)
Problem: In order to help people to know his/her BMI (Body Mass Index) value for health
consideration, you are asked to design a BMI calculator in both English and Metric calculation. It
means that users have options to choose English or metric calculation. Thus if user chooses English
calculation, you have to transform from English to metric because we only give you a metric
formula and a BMI table.
Hand-in:
1. Pack your program (HW2_STUDENTID.c) and document (HW2_STUDENTID.doc (or pdf))
into a compressed file (HW2_STUDENTID.rar (or zip))
2. Send the compressed file to cprog2005@csie.ntu.edu.tw with mail subject
[cprog2005]HW2_STUDENTID
Description:
1. User can choose calculator in English or metric.
2. User can input his/her weight and height.
3. Option checking and boundary checking is requisite.
4. You are asked to output the BMI value, the weight status, and suggestion you made for the user.
Example Output:
Please choose your option (1 for English, 2 for Metric, and 3 for terminating the program): 2
Height (meters): 1.75
Weight (kilograms): 60
Suggestion: Great
Please choose your option (1 for English, 2 for Metric, and 3 for terminating the program): 3
Thanks.
or
Please choose your option (1 for English, 2 for Metric, and 3 for terminating the program): 1
Height (feet): 7
Weight (pounds): 250
Suggestion: Are you O’Neal?
Please choose your option (1 for English, 2 for Metric, and 3 for terminating the program): 3
Thanks.
Reference:
1. Metric Formula:
Body Mass Index can be calculated using kilograms and meters (or centimeters).
weight
BMI =                   , here weight in kilograms and height in meters.
height * height
2. BMI Table
BMI                Weight Status
Below 18.5         Underweight
18.5 – 24.9        Normal
25.0 – 29.9        Overweight
30.0 and Above     Obese

```
To top