0
I have an c program to solve as assignment. Please help!!!
I have to write a program for parking fare. in which the program will read the hours and minutes enter the parking lot..and reads the hours and minutes when it leaves the lot. It has to calculate the difference between two timings and calculate for how many hours the car was in parking lot. The charge fare is , for a truck if it is parked for less than 3 hours the charge will be 20$ and if more than that charge will be 30$ . how to write such program using switch statement? help please!
1 Resposta
+ 1
assing an array of int for every tipe of vehicle.
truck 0 car 1 motorbike 2 bike3
require user to select the vehicle and save the time at user input in a variable.
in the switch statement evaluate the user input and define a case for every vehicle type.
case 0:
charge=20;
surcharge=30;
break;
request a second input to confirm the exit time.
Subtract the time of first input to the time of second input.
if the difference is less than 3 hrs
cout<<charge;
else
cout<<surcharge;
Don't expect others to do your assignment.
next time post your code: you might get better help