The body mass index (BMI) is a measure of relative weight based on height and weight.
T...
Computers and Technology, 21.03.2020 02:51 yddlex
The body mass index (BMI) is a measure of relative weight based on height and weight.
The body fat percentage (BFP) of a human or other living being is the total mass of fat divided by total body mass, multiplied by 100; body fat includes essential body fat and storage body fat. Essential body fat is necessary to maintain life and reproductive functions.
Write a program that calculates and prints the BFP for multiple persons; the program allows user to enter values for the name, gender, age, BMI of each person,
The formula for BFP is:
Child body fat percentage = 1.51 * BMI - 0.70*age – 3.6* gender +1.4
Adult body fat percentage = 1.20 * BMI +0.23 * age – 10.8 *gender – 5.4
where gender is 0 for females and 1 for males.
If the user is 15 years old or younger, he/she will be considered as Child in calculation.
If the user is older than 15, he/she will be considered as Adult in calculation.
Implement the following steps:
Prompts user to enter the number of BFPs that need to be calculated (number of persons). (a int)
Define and call a method to prompt user to enter name (a String). (10 points)
Define and call a method to prompt user to enter gender (a int or String). (10 points)
Define and call a method to prompt user to enter age (a int). (10 points)
Define and call a method to prompt user to enter BMI (a double). (10 points)
Define and call a method to calculate one BFP using the given formula and values (arithmetic expressions). (15 points)
Print out name, age, gender, BMI, BFP of each person. (5 points)
Save BFP values in a double array. (10 points)
Define and call a method to calculate and print the average BFP value of the above double array.(20 points)
Include the following methods in your application, and call/invoke those methods in the main method.
public static String getName( );
public static String getGender( ); or public int getGender ( );
public static int getAge( );
public static double getBMI ( );
public static double calculateBFP (int gender, int age, double bmi);
public static double calculateAverage (double[] bfpArray);
Sample output:
Please enter number of customers:
2
# 1 Customer:
Please enter your age:
21
Please enter your Gender (1 for Male, 0 for Female):
1
Please enter your BMI:
24.5
You are 21 years old
You are a Male adult
Your BMI is 24.5
Your BFP is 18.03%
# 2 Customer:
Please enter your age:
14
Please enter your Gender (1 for Male, 0 for Female):
0
Please enter your BMI:
18.5
You are 14 years old
You are a Female child
Your BMI is 18.5
Your BFP is 19.53%
The average BFP of all 2 customers is 18.78%.
Extra points (5 points):
1) Create a String array to store all the BFP categories
2) Print the percentage of person that are in category "Fitness"
Answers: 3
Computers and Technology, 21.06.2019 17:20, sumitshekhar348
The liang book has an example called which is a javafx application that reads the javabook database using a preparedstatement object. using it as a guide, create a similar application called findbooks. it will read a list of authors from the bookdb created in problem 1 and display them in a listview. if the user selects an author, it should display the author's book titles in a textarea.
Answers: 2
Computers and Technology, 22.06.2019 14:40, Kathryn014
You are working with a professional edition organization. they wish to install the expense tracker which requires the use of 4 custom tabs, 3 custom objects, and one custom app. if the company is already using 4 applications, 36 custom objects, and 7 custom tabs, what will happen when they try to install expense tracker?
Answers: 1
Computers and Technology, 24.06.2019 13:00, CarlosParker99
Think of a spreadsheet as a giant calculator spread of paper chart data collector
Answers: 2
History, 03.01.2020 23:31
Mathematics, 03.01.2020 23:31
Biology, 03.01.2020 23:31
Physics, 03.01.2020 23:31
Biology, 03.01.2020 23:31
Mathematics, 03.01.2020 23:31
Health, 03.01.2020 23:31
History, 03.01.2020 23:31
Mathematics, 03.01.2020 23:31