Question 1: BMI (Body Mass Index) Calculator (use if if-else) You are developing a program that...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Question 1: BMI (Body Mass Index) Calculator (use "if" "if-else") You are developing a program that calculates a person's BMI based on their weight (in kilograms) and height (in meters). Write a Java program that takes the weight and height as input and calculates the BMI using the formula: BMI = weight/ (height^2). The program should then categorize the BMI as follows: Underweight: BMI less than 18.5 Normal weight: BMI between 18.5 and 24.9 Overweight: BMI between 25 and 29.9 Obesity: BMI 30 or greater Display the BMI in the format of %.2f. Please check the usage of System.out.format. After showing the user the category, you ask the user a question "do you some tips according to your BMI?". If the user input yes/y/Y, you print the follow information accordingly: • Underweight: "Please eat well and do more excises." • Normal weight: "Congratulations, you are doing fairly well. Keep on going." Overweight: "Please watch out what you eat and do more excises!" Obesity: "Please contact our experts for professional help." • If the user input anything else, you print the message "Nice to meet you too. Bye!" The output is shown as following (Here show imcomplete combinations of BMI and yes/Y/y and some cases of non yes/Y/y inputs.) Figure 1: BMI = "Underweight", tip="yes" Welcome to BMI Calculator Enter weight (in kilograms): 45 Enter height (in meters): 1.60 BMI: 17.58 Category: Underweight do you some tips according to your BMI? yes Please eat well and do more excises. Welcome to BMI Calculator Enter weight (in kilograms): 68 Enter height (in meters): 1.70 BMI: 20.76 Category: Normal weight do you some tips according to your BMI? Congratulations, you are doing fairly well. Keep on going. Figure 3: BMI = "Overweight", tip "Y" Welcome to BMI Calculator Enter weight (in kilograms): 80 Enter height (in meters): 1.70 BMI: 27.68 Category: Overweight do you some tips according to your BMI? Please watch out what you eat and do more excises! Figure 4: BMI "Obesity", tip "yes" Welcome to BMI Calculator Enter weight (in kilograms): 200 Enter height (in meters): 1.80 BMI: 61.73 Category: Obesity do you some tips according to your BMI?- yes Please contact our experts for professional help. Figure 5: BMI-"Obesity", tip "Yes" (notice case sensitive) Welcome to BMI Calculator Enter weight (in kilograms): 200.05 Enter height (in meters): 1.00 BMI: 61.74 Category: Obesity do you some tips according to your BMI? Yes Nice to meet you too. Bye! Question 1: BMI (Body Mass Index) Calculator (use "if" "if-else") You are developing a program that calculates a person's BMI based on their weight (in kilograms) and height (in meters). Write a Java program that takes the weight and height as input and calculates the BMI using the formula: BMI = weight/ (height^2). The program should then categorize the BMI as follows: Underweight: BMI less than 18.5 Normal weight: BMI between 18.5 and 24.9 Overweight: BMI between 25 and 29.9 Obesity: BMI 30 or greater Display the BMI in the format of %.2f. Please check the usage of System.out.format. After showing the user the category, you ask the user a question "do you some tips according to your BMI?". If the user input yes/y/Y, you print the follow information accordingly: • Underweight: "Please eat well and do more excises." • Normal weight: "Congratulations, you are doing fairly well. Keep on going." Overweight: "Please watch out what you eat and do more excises!" Obesity: "Please contact our experts for professional help." • If the user input anything else, you print the message "Nice to meet you too. Bye!" The output is shown as following (Here show imcomplete combinations of BMI and yes/Y/y and some cases of non yes/Y/y inputs.) Figure 1: BMI = "Underweight", tip="yes" Welcome to BMI Calculator Enter weight (in kilograms): 45 Enter height (in meters): 1.60 BMI: 17.58 Category: Underweight do you some tips according to your BMI? yes Please eat well and do more excises. Welcome to BMI Calculator Enter weight (in kilograms): 68 Enter height (in meters): 1.70 BMI: 20.76 Category: Normal weight do you some tips according to your BMI? Congratulations, you are doing fairly well. Keep on going. Figure 3: BMI = "Overweight", tip "Y" Welcome to BMI Calculator Enter weight (in kilograms): 80 Enter height (in meters): 1.70 BMI: 27.68 Category: Overweight do you some tips according to your BMI? Please watch out what you eat and do more excises! Figure 4: BMI "Obesity", tip "yes" Welcome to BMI Calculator Enter weight (in kilograms): 200 Enter height (in meters): 1.80 BMI: 61.73 Category: Obesity do you some tips according to your BMI?- yes Please contact our experts for professional help. Figure 5: BMI-"Obesity", tip "Yes" (notice case sensitive) Welcome to BMI Calculator Enter weight (in kilograms): 200.05 Enter height (in meters): 1.00 BMI: 61.74 Category: Obesity do you some tips according to your BMI? Yes Nice to meet you too. Bye!
Expert Answer:
Answer rating: 100% (QA)
Here is the Java program that implements the BMI calculator according to the provided requirements j... View the full answer
Related Book For
Fundamentals of quality control and improvement
ISBN: 978-0470226537
3rd edition
Authors: amitava mitra
Posted Date:
Students also viewed these programming questions
-
The units of an item available for sale during the year were as follows: 11 units @ $34 Jan. 1 Inventory Feb. 17 Purchase 12 units @ $36 July 21 Purchase Nov. 23 Purchase 4 units @ $38 17 units @ $39...
-
Can a business-to-business marketer be innovative in the way a brand is built? What are requirements for ingredient brandings, and what are current examples? What industries are more inclined to use...
-
Working on Your Delts. The deltoid muscle is the main muscle that allows you to raise your arm or hold it out. It is connected to the humerus of the upper arm. The person shown below is holding his...
-
Find the point in the first quadrant on the curve y = x + x 1 closest to the origin.
-
(a) What is the rms current in an RC circuit if R = 8.80 k, C = 1.80 F, and the rms applied voltage is 120 V at 60.0 Hz? (b) What is the phase angle between voltage and current? (c) What are the...
-
What is the basic logic behind the Capital Asset Pricing Model (CAPM) and write down the assumptions of Arbitrage Pricing Theory (APT)? Write short notes on the following. A. CML VS SML. B....
-
Larson Property Management Company is one of the largest property management companies in California, with more than 1,000 employees. The company provides a full array of commercial management and...
-
On January 1, Intergen, Inc., invests $200,000 for a 40 percent interest in Ryan, a new joint venture with two other partners each investing $150,000 for 30 percent interests. Intergen plans to sell...
-
What is the price of a 5% fixed rate coupon bond, $100 par value, which has 8 years to maturity given a market discount rate of 5.353%?
-
Consolidation related simulation example: Millennium Capital Management, Inc., (MCM) acquired a 90% interest in NextGen, Inc. MCM's Financial Manager, Matthew Steven, has prepared a draft memo to the...
-
When making decisions, if someone decides something because it will make others like or respect them more, they are most motivated by what type of benefits? a. Product benefits b. Power benefits c....
-
Working on a system to collect solar energy, you are trying to move some charged particles through the open interior of a uniformly charged ring. A colleague vaguely remembers Newton's and...
-
A bullet is fired directly upward and reaches a height of \(45 \mathrm{~m}\). (a) What is the muzzle speed of the gun? (b) How much time does it take the bullet to reach its maximum height?...
-
In 2014, Shaun bought 20% of the ordinary shares of an unlisted trading company. The shares cost 140,000. He owned the shares until January 2022 when he gave all the shares to a friend. On the date...
-
Edward has the following income in 2021-22: He makes a total of 800 of Gift Aid donations during 2021-22. Compute the amount of income tax payable for the year. Bank interest Loan stock interest...
-
Two metal spheres each carry a charge and exert an electric force on each other. Sphere A carries \(2 n\) more surplus electrons than sphere \(\mathrm{B}\), where \(n\) is a positive integer. The two...
-
Problem 2. The curved roof of a new building is constructed by a thin shell structure. To avoid curved walls and ceilings in the interior of the building, a room (with vertical walls and a horizontal...
-
Vectors are drawn from the center of a regular n-sided polygon in the plane to the vertices of the polygon. Show that the sum of the vectors is zero.
-
Reinforced concrete beams are used in bridges. However, cracks develop in these beams and it has an accumulation effect over time. The time to failure of such bridges, in days, is modeled by a...
-
Explain the principles of replication, randomization, and blocking, and discuss their roles in experimental design in a semiconductor manufacturing company.
-
In a time-terminated life testing plan, it is desired to reject lots with a mean life of 1500 hours with a probability of 0.95 and also to reject lots with a mean life of 7500 hours with a...
-
Contrast the assumptions for a finite distributed lag model with those for an infinite distributed lag model.
-
Compute delay, interim, and total multipliers for finite and infinite distributed lag models.
-
Contrast the exogeneity assumption required for HAC standard errors with that required for estimating an \(\mathrm{AR}(1)\) error model.
Study smarter with the SolutionInn App