Wednesday, April 20, 2022

Suppose that overSpeed and fine are double variables. Assign the value to fine as follows: 1 answer below » Suppose that overSpeed and fine are double variables. Assign the value to fine as follows: If 0 < overSpeed <= 5, the value assigned to fine is $20.00; if 5 < overSpeed <= 10, the value assigned to fine is $75.00 if 10 < overSpeed <= 15, the value assigned to fine is $150.00; if overSpeed > 15, the value assigned to fine is $150.00 plus $20.00 per mile over 15.

Suppose that overSpeed and fine are double variables. Assign the value to fine as follows:1 answer below »

Suppose that overSpeed and fine are double variables. Assign the value to fine as follows: If 0 < overSpeed <= 5, the value assigned to fine is $20.00; if 5 < overSpeed <= 10, the value assigned to fine is $75.00 if 10 < overSpeed <= 15, the value assigned to fine is $150.00; if overSpeed > 15, the value assigned to fine is $150.00 plus $20.00 per mile over 15.





1 Approved Answer

Sanjay K 
4 Ratings,(9 Votes)

Answer: The program is given below in programming language C++:
#include<iostream.h>
int main()
{
float overSpeed ,fine,mile;
cout<<"\n"<<"Enter the value of overspeed "<<endl;
cin>>overSpeed;
cout<<"\n"<<"Enter the value of miles "<<endl;
cin>>mile;
if(overSpeed>0&&overSpeed<=5)
fine=20.00;
else if(overSpeed>5&&overSpeed<=10)
fine=75.00;
else if(overSpeed>10&&overSpeed<=15)
fine=150.00;
if(overSpeed>15)
fine=150.0+20.00*mile;
cout<<"fine = "<<fine<<"$"<<endl;
return(0);
}



No comments:

Post a Comment