A parking lot charges different rates depending on the type of vehicle (C Semi, B- Bus). Туре Type Code First Rate Second Rate $2.00/hr after first 3 hours $6.25/hr after first 2 hours | 57.25hr after the first hour Car S1.75/hr first 3 hours Semi $5.25/hr first 2 hours $9.50hr first hour Bus в For example, if a bus has parked for 4 hours, then the total cost is calculated as follows: $9.50 (for the first 1 hours) + 3 x $7.25 (for the last three hours) = $31.25 Write a program named parking.cpp that does the following: • Prompts the user for the type of vehicle they are parking, use a char variable and the letters C, S, and B to track their vehicle information • Asks for the number of hours parked. For simplicity, all times are rounded up to the next hour (use ceil () from the library). • Calculates their total and then print a parking invoice as shown in the sample output • Terminate the program if the user entered an invalid vehicle type. Sample Output 1 - User Enters Invalid Vehicle Type Enter the vehicle type ('C' for car, 's' for semi, 'B' for bus): x+ That is an invalid vehicle type Sample Output 2 - Normal Program Execution Enter the vehicle type ('C' for car, 's' for semi, 'B' for bus) : ce Enter the number of hours parked: 4.04 What is the license plate? ABC 1234 Vehicle Type: Car Time: 4 hours License Plate: ABC 123 Amount Due ($): 7.25
A parking lot charges different rates depending on the type of vehicle (C Semi, B- Bus). Туре Type Code First Rate Second Rate $2.00/hr after first 3 hours $6.25/hr after first 2 hours | 57.25hr after the first hour Car S1.75/hr first 3 hours Semi $5.25/hr first 2 hours $9.50hr first hour Bus в For example, if a bus has parked for 4 hours, then the total cost is calculated as follows: $9.50 (for the first 1 hours) + 3 x $7.25 (for the last three hours) = $31.25 Write a program named parking.cpp that does the following: • Prompts the user for the type of vehicle they are parking, use a char variable and the letters C, S, and B to track their vehicle information • Asks for the number of hours parked. For simplicity, all times are rounded up to the next hour (use ceil () from the library). • Calculates their total and then print a parking invoice as shown in the sample output • Terminate the program if the user entered an invalid vehicle type. Sample Output 1 - User Enters Invalid Vehicle Type Enter the vehicle type ('C' for car, 's' for semi, 'B' for bus): x+ That is an invalid vehicle type Sample Output 2 - Normal Program Execution Enter the vehicle type ('C' for car, 's' for semi, 'B' for bus) : ce Enter the number of hours parked: 4.04 What is the license plate? ABC 1234 Vehicle Type: Car Time: 4 hours License Plate: ABC 123 Amount Due ($): 7.25
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Expert Solution
Introduction
This is a simple cpp question where we use logical or operator and relational operators in if else conditions to check that whether the vehicle type is car, semi or bus. After checking the type we then calculate the due amount according to the price chart for each respective vehicle. Moreover for no of hours in decimal, we calculate the ceil value that means that the next integral number for the decimal number given. For that we used ceil function in cmath library present in c++.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 6 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY