I need help with this lab please help me Tips and Requirements of lab Use parenthesis if needed to ensure your total calculation associativity and order of precedence produces a correct result. Format  your bmi result to 2 decimal places of accuracy.  Use a space around all binary operators (i.e. around arithmetic and assignment operands).  Be sure that your output is well organized. Provide console output comments to organize your result displays.  Define and use named constants in lieu of literal values. Where appropriate, use these named constants in your program solution. Keep source statement width < 80 characters. Be sure to include 3 parts to include in your submission file: program header, the Java* source, the program run (comment out the run).   Remove all tabs - use spaces only. Adhere to the style rules as described in the Coding Style Guidelines.  Make sure the run "matches" your source. If the run you submit could not have come from the source you submit, it will be graded as if you did not hand in a run.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I need help with this lab please help me

Tips and Requirements of lab

  • Use parenthesis if needed to ensure your total calculation associativity and order of precedence produces a correct result.
  • Format  your bmi result to 2 decimal places of accuracy. 
  • Use a space around all binary operators (i.e. around arithmetic and assignment operands). 
  • Be sure that your output is well organized. Provide console output comments to organize your result displays. 
  • Define and use named constants in lieu of literal values. Where appropriate, use these named constants in your program solution.
  • Keep source statement width < 80 characters.
  • Be sure to include 3 parts to include in your submission file: program header, the Java* source, the program run (comment out the run).  
  • Remove all tabs - use spaces only.
  • Adhere to the style rules as described in the Coding Style Guidelines. 
  • Make sure the run "matches" your source. If the run you submit could not have come from the source you submit, it will be graded as if you did not hand in a run.

 

**Testing Specification**

To ensure accurate input, prompt the user to enter values for height and weight, and verify that these values are valid (e.g., positive numbers only).

It's important to confirm that your program produces the expected results by accurately calculating BMI and reporting the correct category.

**Show 5 Test Runs**

Conduct 4 test runs to cover each category. Include a 5th test that demonstrates the program’s ability to handle invalid user input using conditionals.

**Example Run**

Below is a sample output illustrating how your program might display results:

```
/* Test # 1 */
Enter Height: 1
Enter Weight: -1
invalid input...good bye

/* Test # 2 */
Enter Height: 105.4
Enter Weight: 16.9
For the height of 105.4cm and weight of 16.9kg, the BMI is: 15.21
Category is: underweight

/* Test # 3 */
Enter Height: 105.4
Enter Weight: 25
For the height of 105.4cm and weight of 25.0kg, the BMI is: 22.50
Category is: normal weight

/* Test # 4 */
Enter Height: 105.4
Enter Weight: 30.6
For the height of 105.4cm and weight of 30.6kg, the BMI is: 27.54
Category is: overweight

/* Test # 5 */
Enter Height: 105.4
Enter Weight: 34.6
For the height of 105.4cm and weight of 34.6kg, the BMI is: 31.15
Category is: obese
```

This illustrates a sample program output where user inputs help to calculate and categorize BMI effectively, including error handling for invalid inputs.
Transcribed Image Text:**Testing Specification** To ensure accurate input, prompt the user to enter values for height and weight, and verify that these values are valid (e.g., positive numbers only). It's important to confirm that your program produces the expected results by accurately calculating BMI and reporting the correct category. **Show 5 Test Runs** Conduct 4 test runs to cover each category. Include a 5th test that demonstrates the program’s ability to handle invalid user input using conditionals. **Example Run** Below is a sample output illustrating how your program might display results: ``` /* Test # 1 */ Enter Height: 1 Enter Weight: -1 invalid input...good bye /* Test # 2 */ Enter Height: 105.4 Enter Weight: 16.9 For the height of 105.4cm and weight of 16.9kg, the BMI is: 15.21 Category is: underweight /* Test # 3 */ Enter Height: 105.4 Enter Weight: 25 For the height of 105.4cm and weight of 25.0kg, the BMI is: 22.50 Category is: normal weight /* Test # 4 */ Enter Height: 105.4 Enter Weight: 30.6 For the height of 105.4cm and weight of 30.6kg, the BMI is: 27.54 Category is: overweight /* Test # 5 */ Enter Height: 105.4 Enter Weight: 34.6 For the height of 105.4cm and weight of 34.6kg, the BMI is: 31.15 Category is: obese ``` This illustrates a sample program output where user inputs help to calculate and categorize BMI effectively, including error handling for invalid inputs.
**Calculating BMI Using the Metric System**

**Understand the Application**

The *body mass index (BMI)* is a measure that uses a person's height and weight to indicate if their weight is *healthy*.

**The Program Specification**

Write an application that calculates a Body Mass Index (BMI). You will prompt and obtain a height in centimeters and a weight in kilograms from the user at run-time. Validate user input using a conditional statement. If the input is invalid, print a message to the user and exit your program.

Given the user has entered valid input, your program will calculate and print out the corresponding BMI. Include an output statement that decides which BMI category the user falls into.

Calculate the BMI using the following formula: 
\[ \text{bmi} = \frac{\text{weightKg}}{\text{heightCm} / \text{heightCm}} \times 10000 \]

**BMI Categories:**
- Underweight = < 18.5
- Normal weight = 18.5 – 24.9
- Overweight = 25 – 29.9
- Obesity = BMI of 30 or greater
Transcribed Image Text:**Calculating BMI Using the Metric System** **Understand the Application** The *body mass index (BMI)* is a measure that uses a person's height and weight to indicate if their weight is *healthy*. **The Program Specification** Write an application that calculates a Body Mass Index (BMI). You will prompt and obtain a height in centimeters and a weight in kilograms from the user at run-time. Validate user input using a conditional statement. If the input is invalid, print a message to the user and exit your program. Given the user has entered valid input, your program will calculate and print out the corresponding BMI. Include an output statement that decides which BMI category the user falls into. Calculate the BMI using the following formula: \[ \text{bmi} = \frac{\text{weightKg}}{\text{heightCm} / \text{heightCm}} \times 10000 \] **BMI Categories:** - Underweight = < 18.5 - Normal weight = 18.5 – 24.9 - Overweight = 25 – 29.9 - Obesity = BMI of 30 or greater
Expert Solution
Step 1: Question Description:

Given,

  • BMI Categories:
    Underweight = < 18.5
    Normal weight = 18.5 -=to 24.9
    Overweight = 25 to 29.9
    Obesity = BMI of 30 or greater
steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Knowledge Booster
ASCII Codes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education