0

```
//A c++ program that calculate and print parking charges
#include <iostream>
using namespace std;
#include <iomanip>
const double minimumFee = 7.00;
const double hourlyFee = 1.75;
const int numOfCustomers = 2;
const int numOfMinsPerHour = 60;
void inputAndValidate(int,int,int,int);
void convertToMinutes(int&,int&,int&,int&);
void convertBackToTime(int&);
double calcCharge(int&,int&,double);
int entranceMinutes,exitMinutes,entranceTimeInMins,exitTimeInMins ;
int minutesParked,parkedMinutes,entranceHour,exitHour,parkedTime ;
int parkedHours;
double charge;
int main()
{
//int numbOfCustomers = 0;
cout<<"Customer"<<setw(10)<<"Entry Time"<<setw(10)<<"Exit Time"<<setw(10)<<"Parked Time"<<setw(10)<<"Charge"<<endl;
for (int num = 1; num <= numOfCustomers; num++ )
{
inputAndValidate(entranceHour,entranceMinutes,exitHour,exitMinutes);
convertToMinutes(entranceHour,entranceMinutes,exitHour,exitMinutes);
convertBackToTime(minutesParked);
cout<<num<<setw(5)<<entranceHour<<"h"<<entranceMinutes<<setw(5)<<exitHour<<"h"
<<exitMinutes<<setw(5)<<parkedTime<<setw(5)<<calcCharge(parkedMinutes,
parkedHours,charge)<<endl;
}
return 0;
}
void inputAndValidate (int entranceHour,int exitHour,int entranceMinutes,int exitMinutes)
{
//if(numOfCustomers <= 2){
do{
//if(numbOfCustomers <= 2)
cout<<"Input the time you entered the garage"<<endl;
if(entranceHour = 24)
entranceMinutes = 00;
cin>>entranceHour >> entranceMinutes;
cout<<"input the time you left the garage"<<endl;
if(exitHour = 24)
exitMinutes =00;
cin>>exitHour >> exitMinutes;
if((entranceHour<0 && exitHour >= 24) && (entranceMinutes<=0 && exitMinutes >=59))
cout<<"Input the valid time"<<endl;
}while((entranceHour>0 && exitHour <= 24) && (entranceMinutes>=0 && exitMinutes <=59));
}
void convertToMinutes(int& entranceHour,int& exitHour,int& entranceMinutes,int& exitMinutes)
{
int entraceTimeInMins = (entranceHour * numOfMinsPerHour + entranceMinutes);
int exitTimeInMins = (exitHour * numOfMinsPerHour + exitMinutes);
int minutesParked = (exitMinutes - entranceMinutes);
}
void convertBackToTime(int& minutesParked)
{
int parkedHours = (minutesParked / numOfMinsPerHour);
int parkedMinutes = (minutesParked % numOfMinsPerHour);
int parkedTime = (parkedHours , parkedMinutes);
}
double calcCharge(int& parkedHours ,int& parkedMinutes ,double charge)
{
if ((parkedHours>=3 && parkedHours<=24) && (parkedHours>0 && parkedMinutes<=60)){
int additionalHourMin = (parkedHours - 2);
double charge = (additionalHourMin * hourlyFee + minimumFee);
return charge;
}
else
if((parkedHours>=3 && parkedHours<=24) && (parkedMinutes == 0)){
int additionalHours = (parkedHours - 3);
double charge = (additionalHours * hourlyFee + minimumFee);
return charge;
}
return 0;
}
```

this program does not interact with main function in a proper way,PLZ HELP GUYS