Question: Please read all the question carefully and also include // (comments) when you write the code and please make sure you follow the instructions. Thak

Please read all the question carefully and also include // (comments) when you write the code and please make sure you follow the instructions. Thak you

Objective

To build a complete working Java program that offer practice with basic Java graphical user interface components and the interaction of a GUI with an object of a class.

Overview & Instruction

Write a Java program that will calculate a variety of health-related values based on user input via a graphical user interface.

Create (or enhance the previously-used) a HealthLog class. This Java class will store basic parameters based on the calories burned for working out. Design the class to store basic information about a person as well as to calculate various health parameters:

Class HealthLog

Data

Age (years)

Height (inches)

Weight (pounds)

Sex (character 'm' or 'f')

Activity type (either walking or running)

Speed walking or running (miles per hour)

Time working out (minutes)

Methods

Constructor(s) and set/get methods

Validate data

Calculate base calorie needs (to maintain weight)

Calculate body mass index

Determine body mass index classification

Calculate calories burned walking or running

Calculate minimum target heart rate

Calculate maximum target heart rate

Your class should include a method for basic error checking. Build this method to return true of all information "set" into the object is value and false otherwise. Include "common sense" tests for all member variables of the class (for both upper and lower bounds). Any additional flexibility in error checking is optional.

Calculations required for this solution are defined below:

Body Mass Index (BMI)

where h is the height (inches) and w is the weight (pounds)

Body Minimum Target Heart Rate

60% maximum heart rate which is 217 - (0.85 x Age)

Body Maximum Target Heart Rate

80% maximum heart rate which is 217 - (0.85 x Age)

Body Mass Index Classification

From the body mass index, classify the user using the following criteria:

If the BMI is . . .

then the user is . . .

Below 18.5

Underweight

18.5 to 24.99

Normal

25.0 to 29.99

Overweight

30.0 to Up

Obese

Minimum Energy Requirements

Energy needed to maintain weight at bed rest or no activity.

For males:

66.5 + (13.75 x weight in kg) + (5.003 x height in cm) - (6.775 x age)

For females:

655.1 + (9.563 x weight in kg) + (1.850 x height in cm) - (4.676 x age)

Calories Spent During Workout

If running:

(weight in pounds) x (0.75) x (distance in miles)

If walking:

(weight in pounds) x (0.53) x (distance in miles)

Your solution should include two files: one containing the HealthLog class including the data and method definitions and a second file to contain the "driver" application. Your driver application should include a basic graphical user interface with text fields (including appropriate labels), a text area, and a button. You are free to read ahead to include other interface components such as checkboxes or drop-down lists if you wish.

When the user clicks the button

All of the information is collected from the input text fields

The data are then set into the HealthLog object

The input is validated by a message passed to object to determine if all values are in range.

The various calculations methods are invoked and the results are retrieved from the object.

A summary health report is formatted as a String object and set into the text area including:

Calories burned during workout

Maximum and minimum target heart rate range

Body mass index and classification

Minimum daily energy requirements (assuming no activity)

Be very careful of the units of measure for the various calculations. You will also need to research some basic unit conversions to accomplish this solution.

BMI = 703w 3

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!