LAB EXERCISE 3:  BMI Calculator
Goal: In this exercise, you will learn how to:
1.  Insert comments (documentation)
2   Declare variables and assign data types
3.  Assign data to the variables
4.  Compute for a value and display results on the screen


Variables and Data Types

Program Specifications: Create a Java program that will calculate the Body Mass Index (BMI) of a patient.  Store and assign the data - patient name, age, height (inches) and weight (pounds) in variables.  Display the patient’s BMI results on the screen. The formula of the BMI in Standard measurements is:

BMI = weight / (height * height) *703

A. Pre-requisites:
1. Create a folder on your desktop Exercise-3

2. Launch Java EE- Eclipse
Note: You will need to use the Java Perspective Workbench for this exercise

3. Setup your Eclipse Workspace to point to the Exercise-3 folder
    a. Select File-> Switch Workspace
    b. Browse and select your Exercie-3 folder as your Workspace.


B. Requirements:

1.  Create a Java Project and name it as BMICalculator

2.  Create a Class

a.       Name the Class as BMICalculator

b.       Choose the method stub to insert into the class

3.  Add comments (documentation) – Program Description, Author and Date

4.  Declare the variables and assign the data types

a.       patientName - string

b.       age-  integer

c.       height – double

d.       weight – double

e.       BMI - double

5.  Assign and initialize the values to the variables

 

6.  Calculate the BMI

 

7.  Display the output on the Eclipse Console

       

 

 

 

Below is sample of the code:


 

C. Test Application 

1.   Save your code

2.   Compile and run your Java program.

3.   Verify there is no syntax, logical or run-time errors.

4.  Use the following set of test data to determine if the application is calculating properly:

Patient Name  Age  Height     Weight     BMI
Joe Doe           30            68            180  27.37
Jane Jones      35            64            125  21.45

 

D. Submit your exercise in the Canvas Lab Exercise #3 Drop Box.

1. Submit the screen shot of the Eclipse Workbench window showing the Console output screen (see step B7).
NOTE: You can use Paint (save as JPG) or Word to paste the screenshot.

2. Zip up and submit the compressed BMICalculator subfolder that is in the Exercise-03 folder.
NOTE: Right click on the
subfolder and select Send to “Compress Folder”.  The file will have a file extension of .zip.