Write a C program to calculate the parking fare forcustomers who park their cars in a parking lot when the following information isgiven:a) A character showing the type of vehicle: C for car, B for bus, T for truck An integer between 0 and 24 showing the hour the vehicle entered the lotc) An integer between 0 and 60 showing the minute the vehicle entered the lotd) An integer between 0 and 24 showing the hour the vehicle left the lote) An integer between 0 and 60 showing the minute the vehicle left the lotThis is a public lot. To encourage people to park for a short period of time, themanagement uses two different rates for each type of vehicle, as shown in thefollowing table:Vehicle First Rate Second RateCAR RM 0.00/hour first 3 hour RM 1.50/hour after 3 hourTRUCK RM 1.00/hour first 2 hour RM 2.30/hour after 2 hourBUS RM 2.00/hour for first hour RM 3.70/hour after first hourThe input data consist of a character and a set of four integers representing thetype of vehicle and the entering and leaving hours and minutes. But thesepieces of data must be input into the computer in a user-friendly way. In otherwords, the computer must prompt the user to enter each piece of data as showbelow. (Note: Red colour indicates typical data)Type of vehicle? CHour vehicle entered lot (0-24)? 14Minute vehicle entered lot (0-60)? 23Hour vehicle left lot (0-24)? 18Minute vehicle left lot (0-60)? 8The output format is shown below:This program must first calculate the actual time spent in the parking lot foreach vehicle. You may use the following algorithm:a) Compare the minute portion of the leaving and the entering time. If the firstone is smaller than the second,- Add 60 to the minute portion of the leaving time- Subtract 1 from the hour portion of the leaving time Subtract the hour portionsc) Subtract the minute portionsd) Since there are no fractional hour charges, the program must also round theparking time up to the next hour before calculating the charge. The programshould use switch statement to distinguish between the different types ofvehiclesA well-structured program design is required. Run your program six times withthe following data:Test Type Hour In Minute In Hour Out Minute Out1 C 12 40 14 222 B 8 20 8 403 T 2 0 3 594 C 12 40 16 225 B 8 20 14 206 T 2 0 12 0
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here