Question: Run this program 10 times, once for each motorist The if statement and for loop At the end of Main Street in the city of

Run this program 10 times, once for each motorist

The if statement and for loop

At the end of Main Street in the city of Farmville, there is a speed trap, you are sitting in your car behind a bush. Every person going faster than 45 miles per hour is pulled over and fined. Those travelling 45 miles per hour or less are not stopped.

For every person stopped, the city of Farmville gets $60 plus

  • for every mile above the speed limit the city gets $3 a mile if the motorist was going less than 55 miles per hour
  • $5 a mile for speeds greater than or equal to 55 miles per hour and less than 65 miles per hour
  • $10 per mile for speeds greater than or equal to 65 miles per hour.

As an incentive for catching speeders you receive $5 for every speeder caught plus $1 for every mile above the speed limit of 45.

Your input consists of the speed for 1 motorist. For each motorist you must determine whether or not the person was fined, and if so, how much the city of Farmville gets, how much the policewoman gets and the total fine.

Your output should be "nicely" formatted. For example:

CITY OF Your Name TOTAL

SPEED FINED FARMVILLE BOUNTY FINE

----- ----- --------- ------------- -----

27 NO 0 0 0

Test your program with the following data:

27 46 65 29 49 34 75 48 38 45

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!