4.16 LAB: Toll calculation Toll roads have different fees based on the time of day and on weekends. Write a function cal

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

4.16 LAB: Toll calculation Toll roads have different fees based on the time of day and on weekends. Write a function cal

Post by answerhappygod »

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**
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply