CSE 1341: CS I (Fall, 1999)
Homework Assignment #3
Due Date: Wednesday, 9/15/99, before midnight.
Learning Example
Study the program from Chapter 2 of your textbook:
cmtofeet.c and inchtocm.c.
Programming Assignment
Use the above program as your guide,
write a program of your own that does the following:
- Ask the user's name and greet the user.
- Ask her/him to enter her/his height in cm.
- Ask her/him to enter her/his weight in kg.
conversion factor: 1 kg = 2.2 lb
- Convert her/his height and weight into inches and pounds.
- Calculate the BMI as follows:
BMI = 704 * weight / height**2
where height is measured in inches, weight in pounds, and
"**" means "power" (i.e., X ** Y is interpreted as X raise to the
Y-th power).
Standard Test Values
After testing/debugging with your own input values,
make sure that your program works with the following pairs
of height/weight values:
- 150cm, 50kg
- 180cm, 70kg
- 200cm, 100kg
What to Turn in
You need to e-mail both your program, and a trace of its execution
(remember "script") to your TA by the due date.
Prepared by Jeff Tian
(tian@seas.smu.edu).
Last update Sept. 7, 1999.