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: 71% (7 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
-
Find each percent change. Round to nearest tenth of a percent. State if it is an increase or a decrease. From 45 to 95
-
A large company has the opportunity to select one of seven projects-A, B, C, D, E, F, G-or choose the null (donothing) alternative. Each project requires a single initial investment as shown in the...
-
Kalogridis Corp. manufactures industrial dye. The company is preparing its 2011 master budget and has presented you with the following information: a. The projected December 31, 2010, balance sheet...
-
Karen wishes to have $19,526 cash for a new car 5 years from now. How much should be placed in an account now, if the account pays 5.5% annual interest rate, compounded weekly?
-
Water enters one end of a perforated pipe 0.2 m in diameter with a velocity of 6 m/s. The discharge through the pipe wall is approximated by a linear profile. If the flow is steady, find the...
-
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.
-
How have events such as the accounting frauds at AIG, Enron, WorldCom, and several other companies affected people's ideas about corporate governance, the government's role in corporate governance,...
-
Bio Tronix Labs reports the following purchase information for the most recent reporting period: April May June Purchases $325,000 $400,000 $475,000 April was the first month of operations for...
-
Find the derivative of x + xy + y = 27 8. A conical tank 20 feet in diameter and 30 feet tall is leaking water at a rate of 5m cubic feet per hour. At what rate is the water level dropping when the...
-
If 1 Ampere 1 (), and1 C = 6.24 10 electrons (e), sec a. How many electrons are there in 15 mC? e b. How much charge in Colulombs represent 4 x 106 et Coulomb C,
-
Alaskan Markets has a target capital structure of 40 percent debt and 60 percent equity. The pretax cost of debt is 6.3 percent, the tax rate is 35 percent, and the cost of equity is 14.6 percent....
-
Find the inverse of the square root function below and restrict the domain of the inverse function. f(x)=7x-9-6 Show your work here Hint: To add an exponent (x"), type "exponent" or press "^" f-(x) =...
-
The comparative balance sheet for Storm Adventures Ltd., a private company reporting under ASPE, follows: Additional information: 1. Profit for 2014 was $69,900. 2. Bonds payable of $60,000 were...
-
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....
-
Solve (2.4 x 10-5) X 875 (2.5 x 107) x (2.8 x 107)
-
assume there are no outliers. Draw the boxplot for the following frequency table. You may X f rf cf crf 3 7 0.1228 7 0.1228 4 11 0.1930 18 0.3158 5 9 0.1579 27 0.4737 618 6 0.1053 33 0.5789 10 0.1754...
-
Find the partial derivative of the regularized least squares problem: {) (w + x) (wo + w x ( ) + w x ( ) } + |/\||[w1, w2]|| with respect to wo, w, and w2. Although there is a closed-form solution to...
Study smarter with the SolutionInn App