becker.xtras.tollBooth
Interface ITollBooth

All Known Implementing Classes:
SampleTollBooth

public interface ITollBooth

Objects implementing ITollBooth are used to collect tolls from passing vehicles on a highway. The toll assessed is based on the weight of the vehicle, which is provided to the object via the arrival method:

WeightToll
1-5,000$0.35
5,000-25,000$0.50
25,000+$1.50

Please see the package description for a more in-depth discussion of using this interface.

Author:
Byron Weber Becker

Method Summary
 void addView(IView aView)
          Add a view (graphical user interface) to the meter.
 void arrival(int weight)
          A vehicle with the given weight has arrived at the toll booth.
 void collectCoin(double value)
          Collect a coin in payment for the toll.
 void departure()
          A vehicle has departed from the toll booth.
 double getAmountOwed()
          Get the amount still owed for the current vehicle's toll.
 double getTotalCollected()
          Get the total amount collected in tolls.
 int getTotalVehicles()
          Get the total number of vehicles that have passed.
 boolean okToLiftGate()
          Determine whether enough has been paid to lift the gate.
 

Method Detail

arrival

void arrival(int weight)
A vehicle with the given weight has arrived at the toll booth.

Parameters:
weight - The weight of the vehicle arriving at the toll booth.

departure

void departure()
A vehicle has departed from the toll booth.


getAmountOwed

double getAmountOwed()
Get the amount still owed for the current vehicle's toll.


getTotalCollected

double getTotalCollected()
Get the total amount collected in tolls.


getTotalVehicles

int getTotalVehicles()
Get the total number of vehicles that have passed.


collectCoin

void collectCoin(double value)
Collect a coin in payment for the toll.

Parameters:
value - The value of the coin just collected from the driver of the vehicle.

okToLiftGate

boolean okToLiftGate()
Determine whether enough has been paid to lift the gate.


addView

void addView(IView aView)
Add a view (graphical user interface) to the meter. The view's updateView method must be called each time the meter's state changes.