Question: Problem 4 : Taxi Fare ( switch ) : Write a program to compute the total fare for a taxi ride using a switch statement
Problem : Taxi Fare switch:
Write a program to compute the total fare for a taxi ride using a switch statement considering the following table:
tableRide Type,Base Fare first km Perkm fare after km Standard AED AED Premium PAED AED
The program prompts the user to insert the ride type S or P and the total distance travelled a positive value in km only is accepted The program should compute and display the final rate following:
If the distance is less than or equal to km charge the base fare.
If the distance is greater than km charge the base fare plus the additional distance multiplied by the perkm fare.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
