I need help figuring out what it is I did wrong with this program. Here is the code first.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
#include <iostream>
#include <iomanip>
using namespace std;
// global variables
int age, bpm; // bpm is short for beats per minute
// Your processTargetHeartRate function goes here
int processTargetHeartRate()
{
int age, bpm;
cout << "Enter your age: ";
cin >> age;
cout << "Enter your heart beats per minute: ";
cin >> bpm;
return age, bpm;
}
int calculateMaximumHeartRate(int age)
{
int maximumHeartRate;
return maximumHeartRate = 220 - age;
}
// Your displayTargetHeartRate function goes here
void displayTargetHeartRate(int MaximumHeartRate, int age)
{
int maximumHeartRate = calculateMaximumHeartRate(age);
double minimumTargetRate = maximumHeartRate * .6;
double maximumTargetRate = maximumHeartRate * .7;
cout << "Minimum target heart rate is " << minimumTargetRate << endl;
cout << "Maximum target heart rate is " << maximumTargetRate << endl;
}
int main()
{
processTargetHeartRate();
int maximumHeartRate = calculateMaximumHeartRate(age);
displayTargetHeartRate(maximumHeartRate, age);
return 0;
}
|
My problem is that regardless of the numbers I put in for age and beats per minute I still get the same numbers. 132 and 154 for the minimum and maximum respectively. For references the numbers I should be getting numbers like these:
Enter your age: 21 [Enter]
Enter your heart beats per minute: 120 [Enter]
Minimum target heart rate is 119.4
Maximum target heart rate is 139.3
Enter your age: 25 [Enter]
Enter your heart beats per minute: 120 [Enter]
Minimum target heart rate is 117.0
Maximum target heart rate is 136.5
Enter your age: 33 [Enter]
Enter your heart beats per minute: 110 [Enter]
Minimum target heart rate is 112.2
Can anyone tell me what I did wrong here I have no idea?