In this activity, we are going to implement the previous algorithm in Java. Just in case,...

50.1K

Verified Solution

Question

Programming

In this activity, we are going to implement the previousalgorithm in Java. Just in case, here is problem again: Thisprogram calculates and displays a person's body mass index (BMI).The BMI is calculated as the weight times 703 divided by the heightsquared where the weight is measured in pounds and the height ininches. The program should display a message indicating whether theperson has optimal weight (BMI between 18.5 and 25), is underweight(BMI is less than 18.5), or overweight (BMI is greater than25).

Important considerations:

1. There are several ways to design and implement thisalgorithm; however, for the purpose of this exercise and for anautomatic grading, we are going to use the algorithm developed inthe previous exercise.

2. Because of the softchalk limitation about the uses of doublequotation marks, and for uniformity, the String objects have beencreated for you.

3. For the calculation, you must use the Math library for theexponentiation.

4. The curly braces for the if-else statement blocks are locatedin separate lines for uniformity.

Given the following skeleton, please add the missinginstructions

public static void main(String[] args) {

// TODO Auto-generated method stub

Scanner scan = new Scanner(System.in);

double weight;

double height;

double bmi;

String stWeight = \"Enter your weight (pounds) \";

String stHeight = \"Enter your height (inches) \";

String stBMI = \"Your BMI is \";

String stOver = \"You are considered Overweight\";

String stOptimal = \"You have optimal weight\";

String stUnder = \"You are considered Underweight\";

Fill in: ALL OF THE BLANKS HAVE TO BE FILLEDIN!!

//Input prompt the user for weight and height in that order

System.out.println(stWeight);
System.out.println(stHeight);

//Calculate BMI

// Display results of calculation and the message in differentlines

//Overweight

//Optimal Weight

//Underweight

}

Answer & Explanation Solved by verified expert
4.2 Ratings (593 Votes)
CODE FOR THE FOLLOWING PROGRAMimport javautilScanner Import the Scanner classimport javalangMath Import the math classpublic class Main public static void main Stringargs TODO Autogenerated method    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students