Solved–Lab Assignment #3 –Solution

$30.00 $19.00

Lab Objectives Be able to create complete Java programs with Simple arithmetic operations Proper input and output Be able to use proper test data sets to thoroughly test and debug a program BMI = (weight in kilograms) / (height in meters)2 or BMI = ( Weight in Pounds / ( Height in inches)2 x 703…

You’ll get a: . zip file solution

 

 

Description

5/5 – (2 votes)

Lab Objectives

  • Be able to create complete Java programs with

    • Simple arithmetic operations

    • Proper input and output

  • Be able to use proper test data sets to thoroughly test and debug a program

BMI = (weight in kilograms) / (height in meters)2 or

BMI = ( Weight in Pounds / ( Height in inches)2 x 703

(note: the result BMI is an integer.)

Task #1 BMI (Body Mass Index) Calculation in Metric System

Write a Java program to do:

  1. Ask user to enter weight and height in kilograms and meters (may use real numbers such as 110.5 kg or 1.65 meter) respectively.

  2. Calculate the user’s BMI, and round the result to nearest integer.

  3. Display the weight, height, and BMI (note: output format for weight and height uses 2 digits after decimal point, i.e. 1.65 meter okay, but not 1.650 meter.)

Task #2 BMI (Body Mass Index) Calculation in Metric System

Write a Java program to do:

(1) Ask user to enter weight and height in pounds and inches (may use real numbers such as 185.4 lbs or 65.5 inches) respectively.

(2) Calculate the user’s BMI, and round the result to nearest integer.

(3) Display the weight, height, and BMI (note: output format for weight and height uses 2 digits after decimal points.)

Required Test Cases:

Task #1:

  1. 52.5 kg, 1.62m (2) 75 kg, 1.68m (3) your choice

Task #2:

  1. 110.5 lbs, 62.5” (2) 180 lbs, 68” (3) your choice

Observation: What happens if weight entered is 0? What happens if height is 0?

Submission

  1. Create a script file with a copy of both programs and all test runs
  2. Submit on blackboard 3 files: the script file, the task1.java file, and task2.java file. Note: file names could be your choice.

Grading Criteria

Readability and program format (proper use of comments, variable names, indentation, etc.) 2 pts

Task #1 Program and testing (4 pts)

Task #2 Program and testing (4 pts)