Revise Listing 3.4, ComputeAndInterpretBMI.java, to let the user enter weight, feet, and inches. For example, if a
Question:
Revise Listing 3.4, ComputeAndInterpretBMI.java, to let the user enter weight, feet, and inches. For example, if a person is 5 feet and 10 inches, you will enter 5 for feet and 10 for inches. Here is a sample run:
Listing 3.4
Transcribed Image Text:
Enter weight in pounds: 140 feet: 5 Enter inches: 10 -Enter BMI is 20.087702275404553 Normal JEnter JEnter 1 import java.util.Scanner; 2 3 public class ComputeAndInterpretBMI { public static void main(String[] args) { Scanner input = new Scanner (System.in); 5 // Prompt the user to enter weight in pounds System.out.print("Enter weight in pounds: "); double weight = input.nextDouble(); 10 // Prompt the user to enter height in inches System.out.print("Enter height in inches: "); double height = input.nextDouble(); 11 12 13 14 15 16 17 final double KILOGRAMS_PER_POUND = 0.45359237; // Constant final double METERS_PER_INCH = 0.0254; // Constant 18 19 20 21 22 23 24 25 26 // Compute BMI double weightInKilograms = weight * KILOGRAMS_PER_POUND; double heightInMeters = height* METERS_PER_INCH; double bmi = weightInKilograms / (heightInMeters * heightInMeters); // Display result System.out.println("BMI is " + bmi); if (bmi < 18.5) System.out.println("Underweight"); else if (bmi < 25) System.out.println("Normal"); else if (bmi < 30) System.out.println("Overweight"); else System.out.println("Obese"); 27 28 29 30 31 32 33 34 35 } Enter weight in pounds: 146 Jerter Enter height in inches: 70 PJesser BMI is 20.948603801493316 Normal line# weight height weightInkilograms heightInMeters bmi output 146 13 70 19 66.22448602 20 1.778 21 20.9486 25 BMI is 20.95 31 Normal
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 77% (9 reviews)
Health application BMI Program plan Prompt the user to enter weight feet and inches Calculate the BM...View the full answer
Answered By
Muhammad Umair
I have done job as Embedded System Engineer for just four months but after it i have decided to open my own lab and to work on projects that i can launch my own product in market. I work on different softwares like Proteus, Mikroc to program Embedded Systems. My basic work is on Embedded Systems. I have skills in Autocad, Proteus, C++, C programming and i love to share these skills to other to enhance my knowledge too.
3.50+
1+ Reviews
10+ Question Solved
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Question Posted:
Students also viewed these Computer science questions
-
Write a JSF page to let the user enter taxable income and filing status, as shown in Figure 33.27a. Clicking the Compute Tax button computes and displays the tax, as shown in Figure 33.27b. Use the...
-
Revise Listing 3.8, Lottery.java, to generate a lottery of a threedigit number. The program prompts the user to enter a three-digit number and determines whether the user wins according to the...
-
Revise Listing 3.8, Lottery.java, to generate a lottery of a twodigit number. The two digits in the number are distinct.? Listing 3.8 1 import java.util.Scanner; 2 3 public class Lottery { public...
-
Problem 1: The three velocities shown would indicate that the body is not rigid. Given that the body is known to be rigid, one of the three velocities is clearly incorrect. Draw all lines and take...
-
Estimate the instantaneous rate of change at the point indicated 11. P(x) = 3x2 5; x = 2 13. y(x) = 1/x+2; x = 2
-
Considering what you have read in this chapter about team-building, what else would you suggest adding to elements of team-building? What was missing?
-
Discuss the various systems for providing insurance to high-risk drivers
-
Just4U Company uses a job order cost system. The following data summarize the operations related to production for the month of January 20xx. a) Materials purchased on account: b) Materials...
-
The records of Alliston Aviation Supply Inc. include the following accounts for inventory of aviation fuel at December 3 1 , 2 0 2 0 : ( Click the icon to view the records. ) Requirements Which...
-
It is desired to set up a central station for simultaneous monitoring of the electrocardiograms (ECGS) of 10hospital patients. The data from the 10patients are broughtto a processing center over...
-
Write a program that prompts the user to enter an integer for today?s day of the week (Sunday is 0, Monday is 1, ?, and Saturday is 6). Also prompt the user to enter the number of days after today...
-
Write a program that prompts the user to enter three integers and display the integers in non-decreasing order.
-
A large wood products company is negotiating a contract to sell plywood overseas. The fixed cost that can be allocated to the production of plywood is $800,000 per month. The variable cost per...
-
Mijka Company was started on January 1, Year 1. During Year 1, the company experienced the following three accounting events: 1. earned cash revenues of $32,500 2. paid cash expenses of $14,500 3....
-
Q2. Find the equations of the tangent and normal to the curve x3 + y = 2 at (1, 1). Q3. Find if y dx y= :xsinx + (sinx)cosx [10] [10]
-
Assume you have been given $400,000 CAD with access to all listed stocks, bonds, futures, and options worldwide. You can trade in options and futures, in combination with the underlying asset....
-
The formula weight (FW) of a gas can be determined using the following form of the ideal gas law FW = g R T / PV where g is the mass in grams, R is the gas constant, T is the temperature in Kelvin, P...
-
Consider a game in which a fair die is thrown. The player pays $5 to play and wins $2 for each dot that appears on the roll. Define X = number on which the die lands, and Y = player's net profit...
-
Draw the shear and moment diagrams for the beam 3 kip/ft 2 kip/ft B 6 ft 3 ft
-
Complete the following acid-base reactions: (a) HCCH + NaH
-
Rewrite Listing 3.5, ComputeTax.java, using arrays. For each filing status, there are six tax rates. Each rate is applied to a certain amount of taxable income. For example, from the taxable income...
-
Suppose two line segments intersect. The two endpoints for the first line segment are (x1, y1) and (x2, y2) and for the second line segment are (x3, y3) and (x4, y4). Write a program that prompts the...
-
Revise the Course class as follows: Revise the getStudents() method to return an array whose length is the same as the number of students in the course. The array size is fixed in Listing 10.6....
-
Q2.1 Question 2.1 6 Points Describe the three main differences between a 'home-made' dividend and an ordinary dividend. (Note that if more than three differences are described only the first three...
-
This table shows the stock returns for Stock A and Stock B in three different scenarios. The first column shows how likely each of the three scenarios is. The risk-free rate is 5%. Calculate the...
-
The STI Desk Company manufactures student desks that it sells for $80 per unit. Current cost information is as follows: Variable Costs: Direct Material per Desk - $20 Direct Labour per Desk - $15...
Study smarter with the SolutionInn App