Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ application to help users to calculate the BMI rate of Adults. BMI (Body Mass Index) is a measure of body fat based on height

C++ application to help users to calculate the BMI rate of Adults.

BMI (Body Mass Index) is a measure of body fat based on height and weight of adult men or women.

The application should display message to ask and read from the keyboard users to enter the users information from the keyboard about:

*The name of user (string)

*Height in inches (int)

*Weight in pounds (int)

The formula to calculate BMI:

BMI = (weight * 703) / (height * height)

The BMI rate is displayed in 9 output lines in the following format with the name and numbers should be aligned to the right and with 2 decimal digits.

Notes: You must complete reading input before displaying the output and write the comments for each task (not for each line of the code)

--------------------------------------------------

File: SP2023_AdultBMI_Calculator_Martinez.java

Spring 2023 Semester LUIS MARTINEZ

Standard BMI: 18.5 24.9

--------------------------------------------------

User Name: Mary Lane

Height (inches): 62

Weight (pound): 117

--------------------------------------------------

BMI: 21.40

In this Lab3 part1, we are going to rewrite this Lab2 part2 (thats one in the above) by using Object Oriented Programming.

You must provide two classes in this project:

data type class: SP2023_Adult_yourLastName

driver class: SP2023_AdultBMI_Calcultor_DriverClass_yourLastName.

DATA TYPE CLASS

Before writing the code of a data type class, you must create the UML of the data type class 2023_Adult_yourLastName

If you do not have any application to create UML, you can create UML in Word document by creating one table with 1 column x 3 rows as below:

-the first row: for class name in middle

-the second row: for the list of data members in the following syntax with the minus sign (-) at the beginning of each one. Minus(-) means private access.

-variableName:dataType

-the third row: lists all constructors and methods with the plus sign (+) at the beginning of each one. Plus sign (+) means public access

Constructors:

+className()

+className(parameterName:type, )

Methods:

+methodName():returnType

+methodName(parameterName:type, ): returnType

The following is UML of a data type class with:

-the class name as SP2023_Adult_D

-3 data members with private access (-): name of type String, height of type int, weight of type int

-2 constructors with public access (+)

-2 methods with public access (+): method calculateWeight() return decimal number of type double and method toString return a String

SP2023_Adult_Martinez

-name: String

-height: int

-weight: int

+SP2023_Adult_Martinez()

+SP2023_Adult_Martinez(name:String, height:int, weight:int)

+calculate_BMIRate(): double

+toString(): String

To write the code for Data type class, you should base on the UML above:

download the file SP2023_Adult.java from the bottom of this page the save to your computer with the name SP2023_Adult_yourLastName.java

Try to understand the code of of the data type class SP2023_Adult_yourLastName.java

-data members list: declare variables to hold the information of an adult about name (String), height (int inches), weight (int)

-provide 2 constructors: the no-argument constructor and parameterized constructor

-provide the method to calculate the BMI rate by using the following formula:

BMI = (weight * 703) / (height * height)

-provide the method toString() to create the output in the requested format.

-----------------------------------------------------------

File: SP2023_AdultBMI_Calculator_DriverClass_Martinez.java

Spring 2023 Semester LUIS MARTINEZ

Standard BMI: 18.5 24.9

-----------------------------------------------------------

User Name: Mary Lane

Height (inches): 62

Weight (pound): 117

----------------------------------------------------------

BMI: 21.40

DRIVER CLASS

The driver class named SP2023_AdultBMI_Calculator_DriverClass _yourLastName includes the function main().

In the function main(), after reading all the information of one adult that are needed for name, height and weight, you must create the object of the data type class above SP2023_Adult_yourLastname by calling parameterized constructor of the data type class to pass all required information to the object, then use this object to access the method toString() to display the result of the BMI rate.

https://tinyurl.com/5n7kmdvc

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

8.1 Differentiate between onboarding and training.

Answered: 1 week ago

Question

Determine the roles of spatial layout and functionality.

Answered: 1 week ago

Question

Be familiar with the basic ways to manage capacity.

Answered: 1 week ago