CS 230 Spring 2007

Assignment 4 –More Branching

100 points

 

Assigned: 02/14/2007

Due: 02/21/2007 at the start of class

 

Pre-Lab (Do Before Lab):  Bring materials – a way to save a copy for you and a copy to turn in. Plan out tasks, objects, and events needed for program. If this program won’t be EASY for you, write pseudocode for the main button.

 

Main Assignment:

The NJ State Police are working on a new program in conjunction with the EZ Pass system. This program is a simplification. The program should get from the user the number of minutes spent on the highway, the number of miles traveled, 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 and if the person was speeding the program should then calculate the fine (see details below). Your program should include a “Submit” button that will calculate the speed and fine (if applicable) and display the speed and fine (if applicable).  In addition to the calculate capability, provide capabilities to clear all of the controls to start again, and to exit.

Hand in:

Task Details:

·         The schedule for fines is as follows:

o        On or under speed limit - no fine

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

o        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.

o        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.

o        more than 20 mph over the speed limit - fine is $50 plus $5 for each mph over the speed limit.

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

Miscellaneous