Question: In C++ Write a program that calculates a target heart rate. It should have a class called Heart that has a string name and an
In C++
Write a program that calculates a target heart rate. It should have a class called Heart that has a string name and an int age. This class should have getter and setter methods for those member variables. It should also have a method that returns the maximum heart rate which is 220 minus age, a method that returns the maximum target heart rate which is 85% of the maximum heart rate, and a method that returns the minimum target heart rate which is 50% of the maximum. Write a driver program that prompts the user for a name (use getline to get names with spaces) and age and then prints the name, age, maximum heart rate, and the target heart rate. The output should be able to recreate the example. Here is an example run: Please tell me your name: Jake Peralta Please tell me your age: 37 Your name is Jake Peralta Your age is 37 Your maximum heart rate is 183 Your target heart rate is 91-155 Some Notes: Make a project Put class in a header file Use getline to get the first and last name Explicit is for constructors with a single parameter Default value for string is " Use the maxHeartRate() function for range Use const on getters Class variables are private, that's the point of using public getters/setters When naming, start with a lowercase letter for functions When naming, don't use_to start names Not for this assignment, but if you use cin before getline, you'll need to use cin.ignore() to remove the trailing newline before getline will read the next line
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
