Need your inputs please

Pages: 123
this part has been changed to

1
2
3
if (HourIn < 0 || HourIn > 24 || HourOut < 0 || HourOut > 24 || MinIn < 0 || MinIn > 60 || MinOut < 0 || MinOut > 60)
		cout << "You did not enter the correct time";
		return 0;


but when adding {} as suggested, it is generating an error code 4700. Any other suggestion please?
closed account (48T7M4Gy)
It is not going further than that


Tell me I am wrong Beginner2016 but I think you are supposed to add to the starter solution you were given and write the lines of program that extend it to perform the required functions. Until you write those lines that's about it. Maybe it all happens after the 'Press any key to continue ...' but I doubt it. :)
Kemort, when I "press any key to continue...", it just kicks me out and I have to restart again.
closed account (48T7M4Gy)
I thought as much.

So what are you going to write in your program to overcome that?
Beginner2016 - here is your code with { and } in the places I indicated.

It runs. I checked. Please take it from there. If you insist on running it through Visual Studio put something to pause it at the end.

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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include "stdafx.h"      // comment out if not VS
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

int main()
{
	int HourIn, HourOut, MinIn, MinOut, HourParkTime,
		TotalParkTime;

	double TotalCharges;	// To hold the total charges

							// Constants for Minimum Fees
	const double Minfee_Car = 0.00,
		Minfee_Bus = 2.00,
		Minfee_Truck = 3.75;

	// Constants for Hourly rate
	double	CarHourlyRate = 1.25;
	double	BusHourlyRate = 2.50;
	double  TruckHourlyRate = 4.50;

	// Get infos for every vehicle entering the Parking Garage
	char vehicleType;
	string vehicleText;
	cout << "Please enter the vehicle Type:";
	cin >> vehicleType;
	switch (vehicleType)
	{
	case 'c':
	case 'C':
		vehicleText = "Car";
		break;
	case 'b':
	case 'B':
		vehicleText = "Bus";
		break;
	case 't':
	case 'T':
		vehicleText = "Truck";
		break;

	default:
		cout << "You did not enter a valid vehicle type";
		return 0;
	}
	// Get the time for each vehicle
	cout << "\nHour the vehicle entered the garage:";
	cin >> HourIn;
	cout << "\nMinute the vehicle entered the garage:";
	cin >> MinIn;
	cout << "\nHour the vehicle left the garage:";
	cin >> HourOut;
	cout << "\nMinute the vehicle left the garage:";
	cin >> MinOut;

	// Define the parking time and how the time will be counted
	
		HourParkTime = HourOut - HourIn;
	if (MinOut > MinIn)
		HourParkTime++;
	
	if (HourIn < 0 || HourIn > 23 || HourOut < 0 || HourOut > 23 || MinIn < 0 || MinIn > 60 || MinOut < 0 || MinOut > 60)
        {        // <==== ADD THIS {
		cout << "You did not enter the correct time";
		return HourIn || MinIn || HourOut || MinOut;
        }        // <==== ADD THIS }
	 

	// Calculate the charges for each vehicle that parked in the parking garage
	
	if ((vehicleType == 'C' || 'c') && (TotalParkTime > 3))
	{
		TotalParkTime = HourParkTime - 3;
		TotalCharges = (TotalParkTime * CarHourlyRate);
	}
	
	else if ((vehicleType == 'B' || 'b') && (TotalParkTime > 2))
	{
		TotalParkTime = HourParkTime - 2;
		TotalCharges = Minfee_Bus + (TotalParkTime * BusHourlyRate);
	}
	
	else if ((vehicleType == 'T' || 't') && (TotalParkTime > 1))
	{
		TotalParkTime = HourParkTime - 1;
		TotalCharges = Minfee_Truck + (TotalParkTime * TruckHourlyRate);
	}
	else
	{
		TotalCharges = 0.00;
	}

	// Display the results
	cout << "vehicleType:" << vehicleType << endl;
	cout << "TimeIn: " << HourIn << ":" << MinIn << endl;
	cout << "TimeOut:" << HourOut << ":" << MinOut << endl;
	cout << "ParkTime: " << HourParkTime << ":" << endl;
	cout << "TotalCharges: $" << TotalCharges << endl;

	return 0;
}

I figured that is caused by the return 0; but I still can can't figure out why it's not giving the expected output. Please help, I am just a new to this.
Have you made the changes suggested by lastchance?
I did Mickey Boy and it's giving me an error code 4700
1
2
Severity	Code	Description	Project	File	Line	Suppression State
Error	C4700	uninitialized local variable 'TotalParkTime' used	TRY	e:\cosc_1436\try\try\try.cpp	73	


I'M USING VISUAL sTUDIO
Last edited on
Well, yes. Look at line 73. What value will TotalParkTime have at that point?
The value should be TotalParkTime = HourParkTime - (Minimum Hours per vehicle)

for Car = 3
Bus = 2
Truck = 1
And are you, in fact, initialising it to that value? Because in the fixed version of your code that lastchance posted, you're not.

It would be helpful if you could post your actual code that's causing that error.
Mikey Boy, that's really what I am trying to figure out because this is my initial version before lastchance's fix and this version was not giving error message but was not displaying the TotalCharges and the ParkTime

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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include "stdafx.h"
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

int main()
{
	int HourIn, HourOut, MinIn, MinOut, HourParkTime,
		TotalParkTime;

	double TotalCharges;	// To hold the total charges

							// Constants for Minimum Fees
	const double Minfee_Car = 0.00,
		Minfee_Bus = 2.00,
		Minfee_Truck = 3.75;

	// Constants for Hourly rate
	double	CarHourlyRate = 1.25;
	double	BusHourlyRate = 2.50;
	double  TruckHourlyRate = 4.50;

	// Get infos for every vehicle entering the Parking Garage
	char vehicleType;
	string vehicleText;
	cout << "Please enter the vehicle Type:";
	cin >> vehicleType;
	switch (vehicleType)
	{
	case 'C':
		vehicleText = "Car";
		break;
	case 'B':
		vehicleText = "Bus";
		break;
	case 'T':
		vehicleText = "Truck";
		break;

	default:
		cout << "You did not enter a valid vehicle type";
		return 0;
	}
	// Get the time for each vehicle
	cout << "\nHour the vehicle entered the garage:";
	cin >> HourIn;
	cout << "\nMinute the vehicle entered the garage:";
	cin >> MinIn;
	cout << "\nHour the vehicle left the garage:";
	cin >> HourOut;
	cout << "\nMinute the vehicle left the garage:";
	cin >> MinOut;

	// Define the parking time and how the time will be counted
	HourParkTime = HourOut - HourIn;

	if (MinOut > MinIn)
		HourParkTime++;

	if (HourIn < 0 || HourIn > 23 || HourOut < 0 || HourOut > 23)
		cout << "You did enter the correct time" << endl;
	if (MinIn < 0 || MinIn > 59 || MinOut < 0 || MinOut > 59)
		cout << "You did enter the correct time" << endl;


	// Calculate the charges for each vehicle that parked in the parking garage

	if (vehicleType == 'C')
		TotalParkTime = HourParkTime - 3;

	if (TotalParkTime > 0)
	{
		TotalCharges = (TotalParkTime * CarHourlyRate);
	}
	else
	{
		TotalCharges = 0.00;
	}

	if (vehicleType == 'B')
		TotalParkTime = HourParkTime - 2;
	if (TotalParkTime > 0)
	{
		TotalCharges = Minfee_Bus + (TotalParkTime * BusHourlyRate);
	}
	else
	{
		TotalCharges = 0.00;

		if (vehicleType == 'T')
			TotalParkTime = HourParkTime - 1;
		if (TotalParkTime > 0)
		{
			TotalCharges = Minfee_Truck + (TotalParkTime * TruckHourlyRate);
		}
		else
		{
			TotalCharges = 0.00;
		}
	}

	// Display the results
	cout << "vehicleType:" << vehicleType << endl;
	cout << "TimeIn: " << HourIn << ":" << MinIn << endl;
	cout << "TimeOut:" << HourOut << ":" << MinOut << endl;
	cout << "ParkTime: " << HourParkTime << ":" << endl;
	cout << "TotalCharges: $" << TotalCharges << endl;

	return 0;
}

Beginner2016

In the criteria for allotting charges (the 'if' conditions in lines 73, 79, 85 in the full version of code that I posted) you use a variable TotalParkTime which hasn't been set up this point. (Not sure why my compiler didn't pick it up - the CPP shell compiler linked to this site warns you if you look hard enough.) I suspect that you meant HourParkTime in each of these 3 statements.

There is also another fault of these 3 if statements which hasn't been picked up (yet): e.g. the
'C' || 'c'
bit. (I only picked it up because I incurred unreasonable parking charges!)

I think this full if statement should be
if ((vehicleType == 'C' || vehicleType == 'c') && (HourParkTime > 3))
with similar corrections to the other two.

Last edited on
Line 10: TotalParkTime is an uninitialized variable (garbage).

Line 70: You calculate TotalParkTime only if it's a car.

Line 72: You make a decision on TotalParkTime, which is garbage if it wasn't a car.

You have similar problems at lines 82-83 and 92-93.

You probably want your code to look something like this:
1
2
3
4
5
6
7
8
9
10
11
12
  int TotalParkTime = 0;    //  INITIALIZE VARIABLES
  double TotalCharges = 0.0;
...
    if (vehicleType == 'C')
    {   TotalParkTime = HourParkTime - 3;
        //  Note the nested if 
        if (TotalParkTime > 0)
	    {   TotalCharges = (TotalParkTime * CarHourlyRate);
	    }
	    //  else not needed as TotalCharges is already 0.
    }
//  Similar for Bus and Truck 


Line 104: You probably want vehicleText here, not vehicleType.


Last edited on
I just realized that the Totalcharges should equal the Minimum charges depending on each vehicle type and I have made these changes but I am also getting the error 4700 for "TotalCharges" on the last line. Please help. Thank you

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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#include "stdafx.h"      
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

int main()
{
	int HourIn, HourOut, MinIn, MinOut, HourParkTime;
	double TotalCharges;	// To hold the total charges per vehicle
		
	// Constants for Minimum Fees
	const double Minfee_Car = 0.00,
				 Minfee_Bus = 2.00,
				 Minfee_Truck = 3.75;


	// Constants for Hourly rate
	double	CarHourlyRate = 1.25;
	double	BusHourlyRate = 2.50;
	double  TruckHourlyRate = 4.50;

	// Constants for time
	const int MAX_HOURS = 24;
	const int MAX_MINUTES = 60;
	const int MinTime_Car = 3;
	const int MinTime_Bus = 2;
	const int MinTime_Truck = 1;
	
	// Get infos for every vehicle entering the Parking Garage
	char vehicleType;
	string vehicleText;
	cout << "Please enter the vehicle Type:";
	cin >> vehicleType;
	switch (vehicleType)
	{
	case 'c':
	case 'C':
		vehicleText = "Car";
		break;
	case 'b':
	case 'B':
		vehicleText = "Bus";
		break;
	case 't':
	case 'T':
		vehicleText = "Truck";
		break;

	default:
		cout << "You did not enter a valid vehicle type";
		return 0;
	}
	// Get the time for each vehicle
	cout << "\nHour the vehicle entered the garage:";
	cin >> HourIn;
	cout << "\nMinute the vehicle entered the garage:";
	cin >> MinIn;
	cout << "\nHour the vehicle left the garage:";
	cin >> HourOut;
	cout << "\nMinute the vehicle left the garage:";
	cin >> MinOut;

	// Define the parking time and how the time will be counted

	HourParkTime = HourOut - HourIn;
	if (MinOut > MinIn)
		HourParkTime++;

	if (HourIn < 0 || HourIn > 23 || HourOut < 0 || HourOut > 23 || MinIn < 0 || MinIn > 60 || MinOut < 0 || MinOut > 60)
	{        
		cout << "You did not enter the correct time";
		return HourIn || MinIn || HourOut || MinOut;
	}        

	// Calculate the charges for each vehicle that parked in the parking garage
	{
		int TotalParkTime = 0;
		double TotalCharges = Minfee_Car;
		if ((vehicleType == 'C' || vehicleType == 'c') && (TotalParkTime > MinTime_Car))
		{
			TotalParkTime = HourParkTime - MinTime_Car;
			TotalCharges = (TotalParkTime * CarHourlyRate);
		}
		else if (TotalParkTime <= 3)
		{
			TotalCharges = Minfee_Car;
		}
	}

	{
		int TotalParkTime = 0;
		double TotalCharges = Minfee_Bus;
		if ((vehicleType == 'B' || vehicleType == 'b') && (TotalParkTime > MinTime_Bus))
		{
			TotalParkTime = HourParkTime - MinTime_Bus;
			TotalCharges = Minfee_Bus + (TotalParkTime * BusHourlyRate);
		}
		else if (TotalParkTime <= 2)
		{
			TotalCharges = Minfee_Bus;
		}
	}

	{
		int TotalParkTime = 0;
		double TotalCharges = Minfee_Truck;

		if ((vehicleType == 'T' || vehicleType == 't') && (TotalParkTime > MinTime_Truck))
		{
			TotalParkTime = HourParkTime - MinTime_Truck;
			TotalCharges = Minfee_Truck + (TotalParkTime * TruckHourlyRate);
		}
		else if (TotalParkTime <= 1)
		{
			TotalCharges = Minfee_Truck;
		}
	}

	// Display the results
	cout << "vehicleType:" << vehicleType << endl;
	cout << "TimeIn: " << HourIn << ":" << MinIn << endl;
	cout << "TimeOut:" << HourOut << ":" << MinOut << endl;
	cout << "ParkTime: " << HourParkTime << ":" << endl;
	cout << "VehicleCharges: $" << TotalCharges << endl;
	
	return 0;
}
Lines 78-79, 92-93, 106-107: You're creating new local instances of these variables. These variables go out of scope (contents lost) at lines 89,103,118 respectively.
With those } removed, I am getting an unmatched } error.

Then you removed one too many {. The {} are balanced in the code you posted above.

Here is what I came up with:
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
// Declare these ONCE at the beginning of the program and INITIALIZE THEM.
    int TotalParkTime = 0;  
    double TotalParkCharge = 0.0;  
...
		if (vehicleType == 'C' || vehicleType == 'c')
		{   TotalCharges = Minfee_Car;
		    if (TotalParkTime > MinTime_Car))
		    {   TotalParkTime = HourParkTime - MinTime_Car;
			    TotalCharges = (TotalParkTime * CarHourlyRate);
		    }
        }       		
		if (vehicleType == 'B' || vehicleType == 'b') 
		{   TotalCharges = Minfee_Bus;
		    if (TotalParkTime > MinTime_Bus)
		    {   TotalParkTime = HourParkTime - MinTime_Bus;
			    TotalCharges = Minfee_Bus + (TotalParkTime * BusHourlyRate);
		    }		
	    }	    
		if (vehicleType == 'T' || vehicleType == 't') 
		{   TotalCharges = Minfee_Truck;
		    if (TotalParkTime > MinTime_Truck)
		    {   TotalParkTime = HourParkTime - MinTime_Truck;
			    TotalCharges = Minfee_Truck + (TotalParkTime * TruckHourlyRate);
		    }
    	}

I got it to work but the output result for TotalCharges is not correct. Please help

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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#include "stdafx.h"      
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

int main()
{
	int HourIn, HourOut, MinIn, MinOut, HourParkTime;
	double TotalCharges;	// To hold the total charges per vehicle

	// Constants for Minimum Fees
	const double Minfee_Car = 0.00,
				 Minfee_Bus = 2.00,
				 Minfee_Truck = 3.75;


	// Constants for Hourly rate
	double	CarHourlyRate = 1.25;
	double	BusHourlyRate = 2.50;
	double  TruckHourlyRate = 4.50;

	// Constants for time
	const int MAX_HOURS = 24;
	const int MAX_MINUTES = 60;
	const int MinTime_Car = 3;
	const int MinTime_Bus = 2;
	const int MinTime_Truck = 1;

	// Get infos for every vehicle entering the Parking Garage
	char vehicleType;
	string vehicleText;
	cout << "Please enter the vehicle Type:";
	cin >> vehicleType;
	switch (vehicleType)
	{
	case 'c':
	case 'C':
		vehicleText = "Car";
		break;
	case 'b':
	case 'B':
		vehicleText = "Bus";
		break;
	case 't':
	case 'T':
		vehicleText = "Truck";
		break;

	default:
		cout << "You did not enter a valid vehicle type";
		return 0;
	}
	// Get the time for each vehicle
	cout << "\nHour the vehicle entered the garage:";
	cin >> HourIn;
	cout << "\nMinute the vehicle entered the garage:";
	cin >> MinIn;
	cout << "\nHour the vehicle left the garage:";
	cin >> HourOut;
	cout << "\nMinute the vehicle left the garage:";
	cin >> MinOut;

	// Define the parking time and how the time will be counted

	HourParkTime = HourOut - HourIn;
	if (MinOut > MinIn)
		HourParkTime++;

	if (HourIn < 0 || HourIn > 23 || HourOut < 0 || HourOut > 23 || MinIn < 0 || MinIn > 60 || MinOut < 0 || MinOut > 60)
	{
		cout << "You did not enter the correct time";
		return HourIn || MinIn || HourOut || MinOut;
	}

	// Calculate the charges for each vehicle that parked in the parking garage
	{
		int TotalParkTime = MinTime_Car;
		double TotalCharges = Minfee_Car;
		if ((vehicleType == 'C' || vehicleType == 'c') && (TotalParkTime > MinTime_Car))
		{
			TotalParkTime = HourParkTime - MinTime_Car;
			TotalCharges = (TotalParkTime * CarHourlyRate);
		}
		else if (TotalParkTime <= MinTime_Car)
		{
			TotalCharges = Minfee_Car;
		}


		{
			int TotalParkTime = MinTime_Bus;
			double TotalCharges = Minfee_Bus;
			if ((vehicleType == 'B' || vehicleType == 'b') && (TotalParkTime > MinTime_Bus))
			{
				TotalParkTime = HourParkTime - MinTime_Bus;
				TotalCharges = Minfee_Bus + (TotalParkTime * BusHourlyRate);
			}
			else if (TotalParkTime <= MinTime_Bus)
			{
				TotalCharges = Minfee_Bus;
			}


			{
				int TotalParkTime = MinTime_Truck;
				double TotalCharges = Minfee_Truck;

				if ((vehicleType == 'T' || vehicleType == 't') && (TotalParkTime > MinTime_Truck))
				{
					TotalParkTime = HourParkTime - MinTime_Truck;
					TotalCharges = Minfee_Truck + (TotalParkTime * TruckHourlyRate);
				}
				else if (TotalParkTime <= 1)
				{
					TotalCharges = Minfee_Truck;
				}

			}
			// Display the results
			cout << "vehicleType:" << vehicleType << endl;
			cout << "TimeIn: " << HourIn << ":" << MinIn << endl;
			cout << "TimeOut:" << HourOut << ":" << MinOut << endl;
			cout << "ParkTime: " << HourParkTime << ":" << endl;
			cout << "VehicleCharges: $" << TotalCharges << endl;

			return 0;
		}
	}
}
If you're going ignore the advice I've already given you, I really can't help you any further.
Last edited on
Sorry AbstractionAnon, I did not ignore your advice but I think I posted before refreshing and didn't see it. I have changed and adapted per your advice but still the TotalCharges are not correct. Here's what I came up with but I am failing to make it work

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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include "stdafx.h"      
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

int main()
{
	int HourIn, HourOut, MinIn, MinOut, HourParkTime, MinTime;
	int TotalParkTime = 0;
	double TotalCharges = 0.0;

	// Constants for Minimum Fees
	const double Minfee_Car = 0.00,
		Minfee_Bus = 2.00,
		Minfee_Truck = 3.75;


	// Constants for Hourly rate
	double	CarHourlyRate = 1.25;
	double	BusHourlyRate = 2.50;
	double  TruckHourlyRate = 4.50;

	// Constants for time
	const int MAX_HOURS = 24;
	const int MAX_MINUTES = 60;
	const int MinTime_Car = 3;
	const int MinTime_Bus = 2;
	const int MinTime_Truck = 1;

	// Get infos for every vehicle entering the Parking Garage
	char vehicleType;
	string vehicleText;
	cout << "Please enter the vehicle Type:";
	cin >> vehicleType;
	switch (vehicleType)
	{
	case 'c':
	case 'C':
		vehicleText = "Car";
		break;
	case 'b':
	case 'B':
		vehicleText = "Bus";
		break;
	case 't':
	case 'T':
		vehicleText = "Truck";
		break;

	default:
		cout << "You did not enter a valid vehicle type";
		return 0;
	}
	// Get the time for each vehicle
	cout << "\nHour the vehicle entered the garage:";
	cin >> HourIn;
	cout << "\nMinute the vehicle entered the garage:";
	cin >> MinIn;
	cout << "\nHour the vehicle left the garage:";
	cin >> HourOut;
	cout << "\nMinute the vehicle left the garage:";
	cin >> MinOut;

	// Define the parking time and how the time will be counted

	HourParkTime = HourOut - HourIn;
	if (MinOut > MinIn)
		HourParkTime++;

	if (HourIn < 0 || HourIn > 23 || HourOut < 0 || HourOut > 23 || MinIn < 0 || MinIn > 60 || MinOut < 0 || MinOut > 60)
	{
		cout << "You did not enter the correct time";
		return HourIn || MinIn || HourOut || MinOut;
	}

	// Calculate the charges for each vehicle that parked in the parking garage
	
	if (vehicleType == 'C' || vehicleType == 'c')
	{
		TotalCharges = Minfee_Car;
		if (TotalParkTime > MinTime_Car)
			{   TotalParkTime = HourParkTime - MinTime_Car;
		TotalCharges = (TotalParkTime * CarHourlyRate);
			}
	}
	if (vehicleType == 'B' || vehicleType == 'b')
	{
		TotalCharges = Minfee_Bus;
		if (TotalParkTime > MinTime_Bus)
		{
			TotalParkTime = HourParkTime - MinTime_Bus;
			TotalCharges = Minfee_Bus + (TotalParkTime * BusHourlyRate);
		}
	}
	if (vehicleType == 'T' || vehicleType == 't')
	{
		TotalCharges = Minfee_Truck;
		if (TotalParkTime > MinTime_Truck)
		{
			TotalParkTime = HourParkTime - MinTime_Truck;
			TotalCharges = Minfee_Truck + (TotalParkTime * TruckHourlyRate);
		}
	}

			// Display the results
			cout << "vehicleType:" << vehicleType << endl;
			cout << "TimeIn: " << HourIn << ":" << MinIn << endl;
			cout << "TimeOut:" << HourOut << ":" << MinOut << endl;
			cout << "ParkTime: " << HourParkTime << ":" << endl;
			cout << "TotalCharges: $" << TotalCharges << endl;

			return 0;
			
}

Pages: 123