Question: Problem 4 : Write a program to calculate parking cost for a vehicle using a switch statement considering the following table: table [ [

Problem 4: Write a program to calculate parking cost for a vehicle using a switch statement considering the following table:
\table[[Car type (char),First 3hours cost,Rate (After 3hours) per hour],[C,AED 1.0,AED 1.5],[L,AED 1.5,AED 2.5]]
The program prompts the user to insert car type and positive duration. Rates are constant variables.
Input /Output Samples:
Znter the vehicle type (C or e for car and L or 1 for lorry): a Enter the duration in hours: 4
Invalid vehicle type
Enter the vehicle type (C or C for car and L or 1 for lorry): C Enter the duration in hours: -2
Invalid duration
Bnter the vehicle type (C or c for car and L or 1 for lorry): c
Enter the duration in hours: 5
The cost of parking is : ARD 4
Enter the vehicle type (C or C for car and L or I for lorry): I
Enter the duration in hours: 2
The cost of parking is : AED 1.5
I need answer with c++
 Problem 4: Write a program to calculate parking cost for a

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!