Homework 1 (5% of your grade)
Due by email ( jpcvergara@yahoo.com )
on Dec 2, midnight.
For this exercise, you will write programs for toll lane objects.
A toll lane collects payments from cars that pass through the lane.
It is in charge of monitoring its collections, the number of cars
that pass through, including violators (cars that do not pay enough toll).
Assume that the toll fee is 10.00.
A vehicle that pays less than this amount is considered a violator.
A vehicle that pays more than this amount is not given change.
Collections include all payments received.
-
Write a TollLane class (TollLane.java)
for this TollPlaza.java program.
You should be able to deduce from the method calls in the program
which methods are needed in the TollLane class.
-
Write a SmartTollLane class (SmartTollLane.java)
for this TollSystem.java (Updated!) program.
SmartTollLanes are just like TollLanes with the added functionality
of remembering its last violator (you are expected to use inheritance).
TollSystem takes an input file called carsin.txt;
here is a sample .
You do not need to worry about parsing and reading
from the input file; TollSystem.java already takes care of this.
Submit a zip file containing only TollLane.java and SmartTollLane.java.
Do not update TollPlaza or TollSystem when testing your programs.