1) Here is a program in c++ that calculates a speeding ticket, modify the program to...

70.2K

Verified Solution

Question

Programming

1) Here is a program in c++ that calculates a speedingticket, modify the program to double to cost of the ticket in aconstruction zone.

// This project will calculate a speeding ticket between 0 to150 mph.

// 1. Ask for speed.

// 2. Input speed of vehicle

// 3. Calculate ticket cost (50$ if over 50mph with anadditional 5$ for every mph over).

// 4. Display cost of ticket.

#include

using namespace std;

int main()

{

double speed;//to store speed value

//get input

cout<<\"Please insert speed of vehicle: \";

cin>>speed;//check the speed output result accordingly

if(speed<0|| speed>150)

return 1;

if(speed<=55)

return 1;

if(speed<=55)

cout<<\"\nNo SpeedingTicket.\"<<endl;

else if(speed<=75)

cout<<\"\nThe ticket cost is:\"<<(50+2*(speed-55))<<endl;

else if(speed<=110)

cout<<\"\nThe ticket cost is:\"<<(50+5*(speed-55))<<endl;

else

cout<<\"\nDriver should be arrested.\"<<endl;

return 0;

}

Answer & Explanation Solved by verified expert
3.5 Ratings (334 Votes)
The program is modifiedto double to cost ofthe    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students