#include <iostream>
using namespace std;
#include <iomanip>

const double minimumFee       = 7.00;
const double hourlyFee    = 1.75;
const int    numOfCustomers   = 12;
const int    numOfMinsPerHour = 60;

void inputAndValidate(int&,int&,int&,int&);
void convertToMinutes(int&,int,int);
void convertBackToTime(int&,int,int);
double calcCharge(int,int,int);

int main()
{
	int entranceMinutes,exitMinutes,entranceTimeInMins,exitTimeInMins ;
	int minutesParked,parkedMinutes,entranceHour,exitHour,parkedTime ;
	int parkedHours;
	double charge ,totalCharges;
	int numOfCustomers = 12;
		while(numOfCustomers <= 12)
	{
		inputAndValidate(entranceHour,entranceMinutes,exitHour,exitMinutes);
		convertToMinutes(minutesParked,entranceTimeInMins,exitTimeInMins);
		convertBackToTime(parkedTime,parkedMinutes,parkedHours);
		//calcCharge(hours,additionalhours,charge);
		
		cout<<"Customer"<<setw(10)<<"Entry Time"<<setw(10)<<"Exit Time"
			<<setw(10)<<"Parked Time"<<setw(10)<<"Charge"<<endl;
		    <<"\n1"<<setw(5)<<entranceHour"h"entranceMinutes<<setw(5)
				<<exitHour"h"exitMinutes<<setw(5)<<parkedTime<<setw(5)
				<<calcCharge(charge)<<endl;
	}
		return 0;
}
for (int num = 1; num <= numOfCustomers; i++ )
{
	void inputAndValidate (int& entranceHour,int& exitHour,int& entraceMinutes,int& exitMinutes)
	{
		if((0<entranceHour && exitHour <= 24) && (0<entranceMinutes && exitMinutes <=59))
		{
			cout<<"Input the time you entered the garage"<<endl;
			cin>>entranceHour && entranceMinutes;
			cout<<"input the time you left the garage"<<endl;
			cin>>exitHour && exitMinutes;
		}
		else{
			cout<<"Input the valid time"<<endl;
		}
		if(entranceHour == 24)
			entranceMinutes = 00;
		if(exitHour == 24)
			exitMinutes =00;
	}
	void convertToMinutes(int& minutesParked,int entranceTimeInMins,int exitTimeInMins)
    {
		int entraceTimeInMins = (entranceHour * numOfMinsPerHour + entranceMinutes);
	    int exitTimeInMins = (exitHour * numOfMinsPerHour + exitMinutes);
	    int minutesParked = (exitMinutes - entranceMinutes);
    }
    void convertBackToTime(int& parkedTime,int& parkedMinutes,int& parkedHours)
    {
		int parkedHours = (minutesParked / numOfMinsPerHour);
        int parkedMinutes = (minutesParked % numOfMinsPerHour);
	    int parkedTime = (parkedHours && parkedMinutes);
    }
    double calcCharge(int additionalHourMin ,int additionalHours ,double charge)
	{
		if ((3>parkedHours<=24) && (0>parkedMinutes<=59)){
			int additionalHourMin = (parkedHours - 2);
			double charge = (additionalHourMin * hourlyFee + minimumFee);
			return charge;
		}
		else
			if((3>parkedHours<=24) && (parkedMinutes = 0)){
				int additionalHours = (parkedHours - 3);
			    double charge = (additionalHours * hourlyFee + minimumFee);
			    return charge;
			}
			if(hours == 3){
				double charge = minimumFee;
		        return charge;
			}
	}
}

Edited 5 Years Ago by Narue: n/a

Two things that jump out at me.

1 - there's no question asked. You won't get much help if you don't point us in the direction of where you're having trouble.

2 - see the sticky posts at top for information on good posting. Especially, use code tags, like this:

[code]

//your code goes here

[/code]

3- (OK, I said just two things, but anyway) comments in your code can be helpful. I see you have used descriptive names, which is good.

This question has already been answered. Start a new discussion instead.