Question: Write a program that calculates the Ideal Body Weight (IBW) for women based on their height This program will prompt the user to enter the

 Write a program that calculates the Ideal Body Weight (IBW) for

Write a program that calculates the Ideal Body Weight (IBW) for women based on their height This program will prompt the user to enter the height in meters. Then it will display the IBW. If the height that entered by the user is less than one meter or greater than 2 meters, this program should throw an exception. You should apply the following: Define a calculateIB W method to calculate the IBW. This method takes the hight in meters as an argument. If the hight is between 1 and 2 meters this method will calculate the IBW in kilograms using the formula: IBW (kgs) - 22 x (height in meters - 0.1)2 Otherwise, it will throw (IBWException) exception with the height should be between 1 and 2 meters" as an error message. Declare a user-defined exception class (IBWException) with appropriate constructors. In the main method: Prompt the user to enter the height in meters. Calculate IBW by calling a calculateIBW method. Print the ideal body weight Handle the IB WException that might be thrown and print the stack trace for this exception. Handle the exceptions that might be thrown in the main method. Samples of the run: . O O this program calculate the dead body weight To tor women and on their hugnt Enter the height in meter Ideal body weight 49.5 Dotat till en this program calculates the tal Body Weight (3) tor women based on their height Enter the height in meters Salib.Taception the height should be bent at WICRITN.calculate Cat23 abwe teatavat TED DOO han program calculates the Ideal Body Weight for women and on the sight Enter the night in height Ante VAT 10 tv 4 W

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!