Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Toll roads have different fees based on the time of day and on weekends. Write a function calc _ toll ( ) that has three

Toll roads have different fees based on the time of day and on weekends. 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 function returns the correct toll fee (float), based on the chart below.
Weekday Tolls
Before 7:00 am ($6.15)
7:00 am to 9:59 am ($7.95)
10:00 am to 2:59 pm ($6.90)
3:00 pm to 7:59 pm ($8.95)
Starting 8:00 pm ($6.40)
Weekend Tolls
Before 7:00 am ($6.05)
7:00 am to 7:59 pm ($7.15)
Starting 8:00 pm ($6.10)
Ex: The function calls below, with the given arguments, will return the following toll fees:
calc_toll(8, True, False) returns 7.95
calc_toll(1, False, False) returns 6.90
calc_toll(3, False, True) returns 7.15
calc_toll(5, True, True) returns 6.05
PYTHON PLEASE

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions