Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USING JAVA Write a program for calculating body fat and body fat percentage. The following simple formulas will be used for our calculations Body fat

USING JAVA

Write a program for calculating body fat and body fat percentage. The following simple formulas will be used for our calculations

Body fat formula for female:

A1 = (weight * .732) + 8.987

A2 = wrist measurement / 3.14

A3 = waist measurement * .157

A4 = hip measurement * .249

A5 = forearm measurement * .434

B = A1 + A2 - A3 A4 + A5

Body fat = weight B

Body fat percentage = Body fat * 100 / weight

Body fat formula for male:

A1 = (weight * 1.082) + 94.42

A2 = waist measurement * 4.15

B = A1 A2

Body fat = weight B

Body fat percentage = Body fat * 100 / weight

Your program should:

a. Ask for the gender and pertinent information for the given gender and calculate and display all the calculated values (A1, A2, etc.). For example, if the gender is Male, you dont need the wrist measurement.

b. If a gender other than Male or Female is entered, issue an error message and do not calculate/display any data.

c. If the input weight is a negative number or is higher than 400, issue an error message and do not calculate/display any data.

d. Display the following information based on the calculated body fat percentage:

Less than 0 or higher than 400 = An error situation

0 or more, but less than 20 = OK

20 or more, but less than 50 = FINE

50 or more, but 400 or less = NOTHING we can do!

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

International Baccalaureate Computer Science HL And SL Option A Databases Part I Basic Concepts

Authors: H Sarah Shakibi PhD

1st Edition

1542457084, 978-1542457088

More Books

Students also viewed these Databases questions