Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Toll roads have different fees at different times of the day and on weekends. Write a function CalcToll ( ) that has three arguments: the

Toll roads have different fees at different times of the day and on weekends. Write a function CalcToll() that has three arguments: the current hour of time (int), whether the time is morning (bool), and whether the day is a weekend (bool). The function returns the correct toll fee (double), based on the chart below.
Weekday Tolls
Midnight to 6.59 am ($1.15)
7.00 am to 9:59 am ( $2.95
10.00 am to 2.59pm($1.90)
3.00 pm to 7.59 pm ( $3.95)
Starting 8:00 pm ($1.40)
Weekend Tolls
Midnight to 6.59 am ($1.05)
7.00 am to 7.59pm($2.15)
Starting 8.00 pm ($1.10)
Ex The function calls below, with the given arguments, will return the following toll fees:
CalcToll(8, true, false) returns 2.95
CalcToll(1, false, false) returns 1.90
CalcToll(3, false, true) returns 2.15
CalcToll(5, true, true) returns 1.05
IMPORTANT: For the purpose of this, consider noon as NOT morning, with an hour of 0. Midnight IS morning, with an hour of 0. So, a weekday at noon would be called as CalcToll(0, false, false)
LAB ACTIVITY
25.22.1:1/23 LAB: Toll calculations
1020
main.cpp
Load default template...
#include
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

Conduct a needs assessment. page 269

Answered: 1 week ago