
| Project 4 | |
| CSC 140 |
Your simulation must also have the following user controls that operate in real time:
Adjustments across reasonably broad values for the random arrival of cars from each of the four directions. (4 independent adjustments total).
Adjustments across reasonably broad values for independent timing delays of either green or red in each of the "north-south" and "east-west" directions (2 independent adjustments total). The green in one direction and the red in the other direction will have to be coordinated together. You may set yellow to be the same fixed time in all directions.
Your program must also have real time read-outs of the current values set by each of the controls. The values of the random arrival controls should be in cars per minute, and the value of the stoplight controls should be in seconds.
Each class must be well designed according to good Object Oriented techniques. Pay special attention to making your classes consistent, with proper data encapsulation. Also your classes must interact with each other with appropriate is-a, has-a and knows-a relationships. Data passing must be kept to a reasonable minimum, with good justifications for why it is used instead of a relationship.
To implement your intersection simulator the Model-View-Controller paradigm, your Java program must have at least the following classes:
An overall class that contains the whole
application. This class should be relatively simple in logic and
structure, but may contain the timer that runs the entire simulation.
For the Model:
A class that simulates either a gang of
four stoplights or a pair of stoplights.
A class that simulates a single
car.
A class that simulates a lane of
traffic, containing cars in a single direction.
For the View:
A class, probably derived from
Panel or JPanel, that displays the entire intersection and all the action.
Each object in the model should draw itself when given the appropriate Graphics
g object.
For the Controller:
A class, also probably derived
from Panel or JPanel, that contains the minimum of eight controls, and passes
the adjustments to the appropriate objects in the model.
You may want to use additional classes, such as a class to encapsulate the entire Model.
Your Application may be implemented using Java 1.1 or Java 2. It must be visually well designed and intuitive for the user. It must not throw any Null Pointer Exceptions or any other un-caught Exceptions. It must be written using good Java coding style, as discussed in class, with appropriate comments.
Grading
Project 4 is worth 20 points toward the final grade. It will be graded according to the criteria on the Project 4 Grade Report. You will be given a hard-copy of your Grade Report during the Interactive Grading (see Date immediately following). You are required to keep the Grade Reports for all your projects until you have your final grade at the end of the semester, in case there is a question about the grade of any of your projects.
Date
Your project will be interactively graded on Wednesday, May 1st. On Monday, April 29th, each student will sign up for a specific 10 minute period for grading on the following Wednesday. You may have your project graded before May 1st, if you like, by making arrangements with the instructor. Note: You will only have until the Final, Wednesday, May 8th, to upgrade your Project 4 grade. No additional grading for this course will be done after the Final on May 8th. The number of points you have accumulated at the end of the Final will determine your grade for the course.
| Office: B132 | Phone: 353-2250 | sbadman@parkland.edu | ||