Your are almost done, You have need to call functions properly in main function. Declare two variables in main function totalTime
and totalCharge
then call the function
#include <iostream>
using namespace std;
int elapsed_time(int entry_time, int exit_time)
{
int total = 0;
total = (exit_time / 100) * 60 + (exit_time % 100) - (entry_time / 100) * 60
+ (entry_time % 100);
return total;
} // returns elapsed time in total minutes
double parking_charge(int total_minutes)
{
int charge;
if (total_minutes <= 30)
charge = 0;
else if (120 > total_minutes < 30)
charge = (3 + (0.05 * total_minutes));
else
charge = (8 + (0.10 * total_minutes));
} // returns parking charge
void print_results(double charge)
{
cout << "The charge of parking was: " << charge;
}
int main()
{
double charge,minutes;
int entry_time,exit_time;
cout << "What was the entry time? (Enter in 24 hour time with no colon) ";
cin >> entry_time;
cout << "What was the exit time? (Enter in 24 hour time with no colon) ";
cin >> exit_time;
minutes=elapsed_time(entry_time,exit_time);
charge=parking_charge(minutes);
print_results( charge);
}