4.16 LAB: Toll calculation
Toll roads have different fees based on the time of day and onweekends. Write a function calc_toll() that has three parameters:the current hour of time (int), whether the time is morning(boolean), and whether the day is a weekend (boolean). The functionreturns the correct toll fee (float), based on the chart below.
Weekday Tolls
Weekend Tolls
Ex: The function calls below, with the given arguments, willreturn the following toll fees:
calc_toll(8, True, False) returns 2.95calc_toll(1, False, False) returns 1.90calc_toll(3, False, True) returns 2.15calc_toll(5, True, True) returns 1.05
Code in Java please**
4.16 LAB: Toll calculation Toll roads have different fees based on the time of day and on weekends. Write a function cal
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am