Question: Write a programs to calculate the parking fare for etustomers who pack their cars in a parking lot when the following information is given a)

 Write a programs to calculate the parking fare for etustomers whopack their cars in a parking lot when the following information isgiven a) A character showing the type of vehicle for en B

Write a programs to calculate the parking fare for etustomers who pack their cars in a parking lot when the following information is given a) A character showing the type of vehicle for en B for bus, M for motorcycle b) An integer between 0 to 24 showing the hour the vehicle entered the lot c) An integer between 0 and 60 showing the minute the velucle entered the lot d) An integer between 0 and 24 showing the hou the velucle leat the lot +) An integer between 0 and 60 showing the mintite the veluicle left the lot This is a publie tot To encourage people to park for a short period of time, the management uses two different rates for each type of velucle, as shown in Table 1 Vehicle MOTORCYCLE First Rate $0.00/hr first 3 hr 51.00/hr first 2 hr 52.00/hr first but Second Rate $1.50/hr after hr $2 50/hr after 2hr $3.50/lu after first lu CAR BUS Table 1: Rates for Parking No vehicle is allowed to stay in the parking lot later than midnight, it will be towed away The input data consist of a character and a set of four integets representing the type of velucle and the entering and leaving hours and minutes. But these pieces of data must be input into the computer in a set-friendly way. In other words, the computer must prompt the user to enter each piece of data as shown below Type of velucle? Hour vehicle entered lot (0-24)? Minute vehicle entered lot (0-60)? Hour vehicle left lot (0-24)? Munte velicle left lot (0-60 14 23 18 5 Page The output format is shown below. PARKING LOT CHARGE Type of vehicle Car of Bus or Track TIME-IN xx xx TIME-OUT XXXX xx xx XX PARKING TIME ROUNDED TOTAL TOTAL CHARGE RM XX XX This program must first calculate the actual time spent in the parking lot for each vehicle. This means using modtilo atithmetic to handle time calculation. We can calculate this in many ways, one of wlush is shown below. To calculate the time spent in the parking lot, use the following algorithm *) Compare the minute portion of the leaving and entering time If the first one is smaller than the second, Add 60 to the minute portion of the leaving time Subtract 1 from the hour poction of the leaving time b) Subtract the hour portions c) Subtract the minite portions. d) Since there are no functional hotar charges, the program must also rond the parking time up to the next hour before calculating the charge. The program should use the auch statement to distinguish between the different types of vehicles Foged A well-structured program design is required. Run your program six time with the data stown in Table 2 Test Type Hour in Minute In Minute Out Hour Out 14 1 12 40 22 B 8 20 40 2 3 8 3 M 2 0 59 4 12 40 16 5 B 8 20 14 20 6 M 0 12 0 Table 2 Test Data 20

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!