Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming Languages 12th International Symposium Dbpl 2009 Lyon France August 2009 Proceedings Lncs 5708

Authors: Philippa Gardner ,Floris Geerts

2009th Edition

3642037925, 978-3642037924

More Books

Students also viewed these Databases questions

Question

13-1 How does building new systems produce organizational change?

Answered: 1 week ago