Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In Java Body mass index is a measure of whether someone's weight is appropriate for their height. A body- mass-index value between 19 and 25
In Java
Body mass index is a measure of whether someone's weight is appropriate for their height. A body- mass-index value between 19 and 25 is considered to be in the normal range. Here's the formula for calculating body mass index: BMI- (704 x weight in pounds) / height in inches*2 a) Implement a program that prompts the user for height and weight values and displays the associated body mass index. Perform input validation by making sure that the user enters positive decimal numbers for height and weight. See the sample session for details. In particular, note the format for the echo-printed height and weight values and for the generated body-mass-index value For this program, there's no need for multiple classes or even multiple methods. Just put all your code in a main method and put the mainmethod in a BodyMassIndex class Sample session: Enter height in inches: hi Invalid inces value. Must be a decimal number Re-enter height in inches: 0 Invalid inches value. Must be positive. Re-enter height in inches 69.25 Enter weight in pounds dog Invalid pounds value. Must be a decimal number Re-enter weight in pounds:-3 Invalid pounds value. Must be positive. Re-enter weight in pounds 150.5 height 69.25" weight 150.5 pounds body mass index22.1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started