# The BMI formula

Document Sample

```					Department of Electrical Engineering                            EE222_Hmk/ Fall 2007

HOMEWORK/LAB 5
Notes:
During this week NO homework will be due next Thursday.
THIS homework-lab is due on Vista, on Tuesday Sept 18th by 12:30 pm.
You will have 2 quizzes at the end of the Tuesday and Thursday classes, so be there and
prepared.

You homework will have :
- a DOC (no docX, please) or a PDF file for the flow and IPO chart
- all the source file

You have to come up with the charts BY YOURSELF, Pr Mlesna won’t do the job for
you!!!!

In this homework/lab 5, there are 2 problems to solve.

Problem 1: The BMI formula

The Body Mass Index(BMI) formula was developed by Belgium statistician Adolphe
Quelet(1796-1874), and was known as the Quetelet Index. BMI is also referred to as 'body
mass indicator'. BMI is an internationally used measure of obesity.

Body mass index calculation is very straightforward. Calculating body mass index requires
only two measurements, height & weight.

Imperial BMI Formula

The imperial bmi formula accepts weight measurements in pounds & height measurements
in either inches or feet.
1 foot = 12 inches
inches² = inches * inches

Table: Imperial BMI Formula
(weight in pounds * 703 )
BMI =
————————————
( kg/m² )
height in inches²

Metric Imperial BMI Formula

The metric bmi formula accepts weight measurements in kilograms & height measurements
in either cm's or meters.
1 meter = 100cms
meters² = meters * meters

Table: Metric BMI Formula
BMI =      weight in kilograms
( kg/m² )   ————————————
height in meters²

Calculate BMI & Find Weight Status

Table: BMI Weight Status Categories
BMI         Weight Status
Below 18.5     Underweight
18.5 -24.9     Normal
25 - 29.9      Overweight
30 & Above     Obese

Questions

Define
1. the inputs, outputs and intermediate processing items
2. the IPO chart of the BMI calculation : algorithm used to calculate the BMI
3. define the algorithm flow chart

Write a program based on the previous answers. Moreover, your program will
1. ask the user to enter his/her name (user_name)
2. ask the user to enter the necessary inputs that your program needs to calculate
the BMI
3. verify the units of the inputs and use the appropriate BMI formula
4. based on the results of the BMI calculation, the program will display: “
user_name, your weight status is weight_status”

Your will provide me with :
- a “.doc” or “.pdf” (if you want to scan your flow chart) file providing the answers to
questions 1 to 3.
- ALL the source files of your program.

Problem 2: The Single pile game

Number of players: 2 (you and the computer)
Game set: there is a pile of 22 sticks.
Purpose of the game: each player chooses to remove a certain number of sticks from the
sticks pile (between 1 and 4). The player that first manages to empty the pile (0 stick left in
the pile) wins.
Talent required: good memory and calculus

Here is a list of messages that your program MUST have:
-"Welcome to the Single-Pile Game !"
-you must choose who will play first:
"Who plays first: [P]layer or [C]omputer?"
If you (the human player) enter something different from P or C

Page 2 of 3
"Invalid entry; please try again. "
-message to inform the human player of the number of sticks left in the pile appears after
each player’s move.
"There are now " numSticks " in the pile."
numSticks is the variable that traces the number of sticks left in the pile
-to ask the human player (you), how many sticks you want to remove from the pile:
"How many sticks do you want to remove [1-4]?"
Remember that players can only remove between 1 and 4 sticks at each move.

-if you don’t enter a number in the range, then this message appears:
"Between 1 and 4, and no more than there are " numSticks "in the pile, please."
-when it’s the computer turn to play, it will just tell you
"I am taking " xxx " sticks from the pile."
The number that the computer will remove are random, you (the human player) just know
that it will follow the rule that is no more than 4 sticks at a time.
-If you (human player) take the last stick(s) of the pile, the message:
"You win. Congratulations!"
If you are not the player removing the last stick(s) then the message "I win! Better luck next
time..." should appear.

Questions

Define
1. the inputs, outputs and intermediate processing items; State VERY CLEARLY ALL
your variables, their types and initial values.
2. define the algorithm flow chart

1. Write a program based on the previous answers.

Your will provide me with :
- a “.doc” or “.pdf” (if you want to scan your flow chart) file providing the answers to
questions 1 to 2. NO OTHER TYPE OF FILES FOR THE FLOW CHART
- ALL the source files of your program.

§§§

Page 3 of 3

```
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
 views: 30 posted: 7/27/2012 language: pages: 3
How are you planning on using Docstoc?