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