Informal Spec to be Tested

 

 

The NJ State Police are working on a new program in conjunction with the EZ Pass system. This program is a simplification. It should ask the user how many cars will be processed in a batch. Then, for each car, the program should ask the user for the speed of the car and the speed limit on the stretch of the Garden State Parkway traveled - (in real life these would be obtained via the scanning process)). The program should then display the speed. The program should then calculate the fine (see details below). If the person is to be fined, the program should display a bill for the person (see below). After processing all of the cars in the batch, the program should display a report including how many cars were speeding, the percent of cars speeding, the total fines charged, and averages (details below).

 

Details:

1)       1)     The schedule for fines is as follows:

        On or under speed limit - no fine

        - less than or equal to 5 mph over the limit - $20 fine

        - more than 5 mph and less than or equal to 10 mph over the speed limit -

              fine is $20 plus $2 for each mph over the speed limit.

        - more than 10 mph and less than or equal to 20 mph over the speed limit -

              fine is $20 plus $4 for each mph over the speed limit.

        - more than 20 mph over the speed limit -

              fine is $50 plus $5 for each mph over the speed limit.

2)       2)     If the speed limit on the stretch of highway is 65 or higher, then the above fines are DOUBLED.

   3) The program should ensure that the user types in valid data (i.e. positive number of cars, mph, speed limit no lower than 35, and no higher than 65). Loop to ensure they cannot in any circumstances get invalid data into your calculations.