Basic Javascript

Scenario:

 

A fitness instructor wants to find out the number of students who are underweight, ideal, overweight and obese. The BMI (Body Mass Index) is a common tool for deciding whether a person has an appropriate body weight. It measures a person’s weight in relation to their height. BMI is calculated as follows:

 

BMI = (weight)/(height*height).

 

BMI Category
Less than 18.5 Underweight
At least 18.5 but less than 25 Ideal
At least 25 but less than 30 Overweight
Over 30 Obese

 

Your goal is to create an application to allow the fitness instructor to continuously input student’s name, height (meters) and weight (kilograms) until the fitness instructor has indicated they are finished entering data. When an invalid input is provided the user must see an error message and be re prompted. Once all of the data has been entered, calculate the BMI of each student and track the number of students in each category.

 

At the end, print a well formatted summary report listing the total number of students entered, the total number of students in each category and the average BMI.

 

 

 

 

 

Test Input/Output

 

Enter Student 1 name(Type ‘Exit’ to quit): Robert Frost

Enter Student’s Height (meter): -5

Invalid Height! Enter input again!!

Enter Student’s Height (meter): 1.7
Enter Student Weight (kg): 65

 

Student 1 BMI: 22.49

Student Category: ideal

 

Enter Student 2 name(Type ‘Exit’ to quit): Tony Dough

Enter Student’s Height(meter): 1.8
Enter Student Weight(kg): asd

Invalid Weight! Enter input again!!

Enter Student Weight(Kg): 90

 

Student 2 BMI: 27.78

Student Category: Overweight

 

Enter Student name 1(Type ‘Exit’ to quit): Rebecca Ali

Enter Student’s Height(meter): 1.60
Enter Student Weight(Kg): 80

 

Student 2 BMI: 31.25

Student Category: Obese

 

Enter Student name 1(Type ‘Exit’ to quit): ‘Exit’

 

** Summary Report **

 

Total Student 3

Total underweight: 0

Total ideal: 1

Total overweight: 1

Total obese: 1

Average BMI: 27.17

 

 

 

Other Requirements:

 

  • Your solution mustdemonstrate the concept of one-dimensional arrays.
  • Your solution must not use methods other than main. They are not required for this assignment.
  • Your solution must not import any Java library other than JOptionPane, including java.util.Arrays.
  • Your solution must contain appropriate validation. Try to think about what might be considered appropriate as you are designing your solution beyond what has already been explicitly provided.

Note: You must use the JOptionPane class for input/output. Additionally, if you use System.exit as shown in the textbook, it may only be used as the absolute last line in the program. You may not use System.exit, or any variant that exits the program in the middle of the program. The program should be designed to only exit once the algorithm has finished.

 

Programming Assignment 5: Solution Design

 

Create a defining diagram that shows the input, processing, and output

Create a solution algorithm using pseudocode

Show testing using the desk checking table method, to include test data, expected results, and a desk checking table. Make sure your desk checking considers multiple cases including both valid and invalid test data to prove your algorithm will work in all cases

Upload a Word document containing only items about to Blackboard

Grading Criteria
Requirement Points
Defining Diagram with input, processing, and output 40
Efficient Solution Algorithm 40
Through Desk Checking Table including test data, and expected results 20

 

 

Programming Assignment 6: Solution Implementation

 

Write a well-documented, efficient Java program that implements the algorithm you identified. Include appropriate documentation as identified in the documentation expectations document.

Note: You must use the JOptionPane class for input/output. Additionally, if you System.exit as shown in the textbook, it may only be used as the absolute last line in the program. You may not use System.exit, or any variant that exits the program in the middle of the program. The program should be designed to only exit once the algorithm has finished.

Upload the .java file of the final program to Blackboard. Be careful that you do not submit a .class file instead of a .java file.

Your program must successfully compile using jGrasp. Partial credit is available. Any final program that does not compile, for any reason, will receive an automatic zero. Other IDEs often place in additional code that you are unaware of, doing too much of the work for you. You are strongly discouraged from using IDEs other than jGrasp.

 

 

 


    Make your order right away

    Confidentiality and privacy guaranteed

    satisfaction guaranteed