Reference no: EM132356236
Question
Exercise 1
When getting into a fitness program, you may want to figure out your target heart rate so you don't overexert yourself. The Karvonen heart rate formula is one method you can use to determine your rate. run program that prompts for your age and your resting heart rate. Use the Karvonen formula to determine the target heart rate based on a range of intensities from 55% to 95%. Generate a table with the results as shown in the example output (format matters). The formula is
TargetHR = (((220 - age) - restingHR) * intensity) + restingHR
Example Output
Resting Pulse: 65 Age: 22
Intensity | Rate
----------|--------
55% | 138 bpm
60% | 145 bpm
65% | 151 bpm
: : (extra lines omitted)
85% | 178 bpm
90% | 185 bpm
95% | 191 bpm
Exercise 2
Run a code that the Guess the Number game that has three levels of difficulty. The first level of difficulty would be a number between 1 and 10. The second difficulty set would be between 1 and 100. The third difficulty set would be between 1 and 1000.
Prompt for the difficulty level, and then start the game. The computer picks a random number in that range and prompts the player to guess that number. Each time the player guesses, the computer should give the player a hint as to whether the number is too high or too low. The computer should also keep track of the number of guesses. Once the player guesses the correct number, the computer should present the number of guesses and ask if the player would like to play again.
Example Output
Let's play Guess the Number.
Pick a difficulty level (1, 2, or 3): 1
I have my number. What's your guess? 1
Too low. Guess again: 5
Too high. Guess again: 2
You got it in 3 guesses!
Play again? n
Goodbye!