Fall 2003 CS0007: Introduction to Computer Programming Assignment 2: BMI |
||||||
Have your old handouts ready as a reference and assignment 1. |
||||||
|
||||||
This assignment is similar in nature to several of the examples we did in class. You will be following the "calculator" style of program that goes: (1) get input, (2) calculate answer, (3) print results. You will be declaring a few variables and using some built-in methods. |
||||||
What
to do |
||||||
You will write a small program to calculate people's Body Mass Index. This number is often used in conjuction with weight and body fat percent to give people an idea of their physical health. The steps to calculate BMI are as follows:
Your variables should all be of type double and you should use Console.in.readDouble() from the tio package to read them in. |
||||||
Sample
output |
||||||
Here is a sample of how your program might look when executed. You don't have to do exactly this, but it should be similar.
The output is kind of ugly, but formatting doubles and floats is not exactly easy, so we'll learn that later. For now, we'll just live with the extraneous decimal places. |
||||||
Handing
your work in |
||||||
Don't forget to begin your filename with you user id and to put your name & email in the top comment of your program. Copy both your java source file and your compiled .class file in the handin directory. Use assignment2 as the directory name. See the assignment 1 or the handing your code in handout to remind you of the steps. Don't forget to verify the handin using ls. |
||||||
Suggestions/Hints |
||||||
This is fairly similar to the programs we wrote together in class. My advice is to model your program after them. |
||||||
|