6.26 lab: toll calculations 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 before 7:00 am ($1.15) 7:00 am to 9:59 am ($2.95) 10:00 am to 2:59 pm ($1.90) 3:00 pm to 7:59 pm ($3.95) starting 8:00 pm ($1.40) weekend tolls before 7:00 am ($1.05) 7:00 am to 7:59 pm ($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

Respuesta :

For the implementation of toll calculation we are using C++ programming.

What is C++ programming?

A general-purpose programming and coding language is C++ (also known as "C-plus-plus"). As well as being used for in-game programming, software engineering, data structures, and other things, C++ is also used to create browsers, operating systems, and applications.

Code for the toll calculation:

#include<iostream>

#include<iomanip>

using namespace std;

double CalcToll(int hour,bool isMorning,bool isWeekend)

{  

double res;

 if(isWeekend)

 {

 if(isMorning && hour<7)

  {

  res=1.05;

  }

 else if(isMorning && (hour>=7 || hour<=12))

  {    

res=2.15;

 }

  else if(!isMorning && (hour>=1 || hour<=7))

  {

   res=2.15;

 }

 else if(!isMorning && hour>=8)

 {

  res=1.10;

 }

}

else

 {

  if(isMorning && hour<7)

  {

  res=1.15;  

}

  else if(isMorning && (hour>=7 || hour<=9))

  {

   res=2.95;

 }

 else if(!isMorning && (hour>10 || hour<=12 || hour>=1 || hour<=2))   {    res=1.90;

 }

  else if(!isMorning && (hour>=3 || hour<=7))

  {

   res=3.95;

 }

 else if(!isMorning && hour>=8)

  {

  res=1.40;

 }

 }

 return res;

}

int main()

{

 cout<<CalcToll(8,true,false)<<endl;

 cout<<CalcToll(1,false,false)<<endl;

cout<<CalcToll(3,false,true)<<endl;

cout<<CalcToll(5,true,true)<<endl;

return 0;

}  

Output:

2.95

1.9

2.15

1.05

Learn more about C++ Programming click here:

https://brainly.com/question/28959658

#SPJ4