Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design a java class that performs BMI calculations. Call this program Individual Health Assessment Program. The specifications for the formula for Body Mass Index (BMI)

Design a java class that performs BMI calculations. Call this program Individual Health Assessment Program. The specifications for the formula for Body Mass Index (BMI) is as follows:

BMI = Weight (in kg) / height (in meters) squared

Create a class BMICalculator which is passed weight and height data and returns the BMI index value. The class should also return a string message for a given value of BMI as a report as follows:

Seriously underweight for BMI value below 18.0

Underweight for BMI value less than 18.5

Normal weight for BMI values between 18.5 24.9 Overweight for BMI values between 25 29.9

Obese for BMI values between 30-39.9

Part 2

Using the BMICalculator class, implement a GUI interface that allows an operator to evaluate a person's BMI health factors that may contribute to his/her wellness. Create a JavaFX GUI in which the height and weight is entered by an operator and the BMI value is calculated and checked against ranges and outputs a small notification message displaying the calculated BMI value.

Part 3

If a BMI calculation results in a value that is far out of bounds (e.g. <18.5 or greater than or equal to 35), create a GUI notification box that he or she should see a doctor, or to consult a health professional and display the proper message for that value as shown above e.g. is BMI value is 17 the notification box should display message string BMI is 17, Patient is Seriously Underweight and should consult with Doctor.

Lab Process

In this lab, the developer should do the following activities:

Part 1

Create a java class BMICalculator that has a default constructors.

Create private data members that are floating-point numbers to represent weight and height.

Create a private data member that is a collection of strings representing the BMI report strings such as Seriously Underweight for example.

Create 2 separate methods on the BMICalculator class to set the height and weight variables used in BMI calculation from user input at the command line that asks for weight in kg and height in meters.

Create a method on BMICalculator to calculate the BMI and return that value.

Create a class IndividualHealthAssessment whose main method creates a BMICalculator object and gets input from the user and outputs the calculated BMI with a message of what the report is for that value of BMI as a string which it prints on the command line.

Part 2

Create a JavaFX project which builds a GUI called IndividualHealthAssessment which creates a basic GUI anchor pane container. Make sure to see that the project has a .fxml file and controller class separate from the main app. Double click on the projects .fxml file and it should open Scene Builder for that project.

Add a private reference of type BMICalculator which should be instantiated using operator new in the initialize method generated by default in the controller class.

Using Scene Builder add 2 textbox controls that will take input for weight in kg and height in meters. In addition, add labels above these text boxes that display labels showing that the textbox control either represents the height or weight parameter.

Using Scene Builder add a button and label it Calculate BMI.

Using Scene Builder add a label that will be used to display the calculated BMI value (named for example BMICalcLabel)

Using Scene Builder add a label that will be used to display the report message for the calculated BMI e.e BMIMessageLabel.

Using Scene builder add an event handler method named handleCalcBMI to the CalculateBMI button.

Implement the handleCalcBMI button event handler. When clicked, it should fetch the entries that have been made in the weight and height textbox controls (which are strings) and convert them to floating-point numbers. It should then pass those numerical values to the internal BMICalculator object by invoking the set..() methods on the BMICalculator class. The handler function should then fetch the calculated BMI value and display its value in the BMICalcLabel label and display the BMI report message in the BMIMessageLabel label.

Part 3

At the end of the button click handler handleCalcBMI, add a check to see if the calculated BMI is out of range i.e. < 18.5 or > 35.0 and create a health advisory message. This should be a small JavaFX Dialog GUI, with an OK button. The label of the Dialog should inform the operator that the subject must consult the Doctor immediately due to their BMI indication that they are overly obese or seriously underweight.

when I do on my computer it shows me error about Bmi calculator file and also about import files error what I have to do for it please help me ?

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

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions

Question

2. Show the trainees how to do it without saying anything.

Answered: 1 week ago