Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.Using Java Write a program to input a persons age and rest heart rate, then output the persons maximal heart rate and aerobic target zone.

1.Using Java Write a program to input a persons age and rest heart rate, then output the persons maximal heart rate and aerobic target zone.

In the main method, a loop is need to keep prompting the user to input age and rest heart rate until the user inputs negative number as either the age or rest heart rate.

The program MUST have the following four methods, in additional to the main method:

(1) A method named inputValue that prompts the user to input an integer

(2) A method named maxHR that returns the maximal heart rate

(3) A method named targetZone that returns either the lower or higher end of the aerobic target zone

(4) A method named printInfo that displays the maximal heart rate, the lower and higher ends of the aerobic target zone

image text in transcribed

For optimal aerobic benefit, a person should maintain a heart rate (heartRate) between 60% and 80% of his or her maximal heart rate, this range is called the aerobic target zone. heartRate = k*(maxHeartRate-restHeartRate) + restHeartRate where: restHeartRate is the person's rest heart rate maxHeartRate is a person's maximal heart rate calculated by maxHeartRate 220 - age k is the percentage of maximal heart rate(0.06 for the lower rate, and 0.08 for the higher rate) Write a program to input a person's age and rest heart rate, then output the person's maximal heart rate and aerobic target zone. In the main method, a loop is need to keep prompting the user to input age and rest heart rate until the user inputs negative number as either the age or rest heart rate. (2 points) The program MUST have the following four methods, in additional to the main method: (1) (2 points) A method named inputValue that prompts the user to input an integer (the main method will invoke this method twice to get age and rest heart rate), the header of the method should be public static int inputValue (Scanner) (2) (2 points) A method named maxHR that returns the maximal heart rate, the header of the method should be public static int maxHR (int 3) (3 points) A method named targetZone that returns either the lower or higher end of the aerobic target zonee (rounded to the nearest integer after the calculation), the header of the method should be public static int targetZone (double, int, int ) // the parameter list is in the order of // k, restHeartRate, maxHeartRate 4) (1 points) A method named printinfo that displays the maximal heart rate, the lower and higher ends of the aerobic target zone, the header of the method should be public static void printInfo (int, int, int) // the parameter list is in the order of // maxHeartRate, lowerHeartRate, higherHeartRate

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

Google Analytics 4 The Data Driven Marketing Revolution

Authors: Galen Poll

2024th Edition

B0CRK92F5F, 979-8873956234

More Books

Students also viewed these Databases questions

Question

What is human nature?

Answered: 1 week ago