Advertisement
akosiraff

TaxiFare Answer

Oct 7th, 2018
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1.  
  2. Download: https://solutionzip.com/downloads/taxifare/
  3. Write a program, using Object-Oriented Programming, to compute a taxi fare. In some cities, taxi fares are calculated based on start and end zones plus a per-minute charge. In this city, there are three zones (1, 2, and 3) and a graduated scale for time. The program should have a function that computes the taxi fare. The function should receive three parameters: the starting zone, the ending zone, and the time of the ride. It should return the total fare for the ride. Use the following table for your calculations:Start zone End zone Base charge
  4. 1 1 $5.00
  5. 1 2 $7.00
  6. 1 3 $8.00
  7. 2 1 $7.00
  8. 2 2 $5.00
  9. 2 3 $9.00
  10. 3 1 $8.00
  11. 3 2 $9.00
  12. 3 3 $5.00Time is more than But is not over Charge
  13. 0 minutes 4 minutes $0.75 per minute
  14. 4 minutes 10 minutes $3.00 plus $0.50 per minute over 4 minutes
  15. 10 minutes 20 minutes $6.00 plus $0.40 per minute over 10 minutes
  16. 20 minutes No limit $10.00 plus $0.30 per minute over 20 minutesFor example, if the start zone is 1 and the end zone is 1 with ride time of 15 minutes, then program displays:Taxi fare from zone 1 to zone 1 with travel time of 15 minutes is $13.00If the start zone is 1 and the end zone is 3 with ride time of 25 minutes, then the program displays:Taxi fare from zone 1 to zone 3 with travel time of 25 minutes is $19.50
  17. Download: https://solutionzip.com/downloads/taxifare/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement