Create a new class that is a subclass of Aisle. Your new class should
override the step
method. The new version
of step
should perform exactly the same logic as the old
version with the following difference: at the end of each time step,
it should loop through the line of customers, and remove each customer
with a small, fixed probability. This may not be the most realistic
model of impatience, but it will have the desired effect that the
longer a customer is forced to wait, the more likely it is that they
will give up.
You will need to iterate backwards through the list of customers, since removing a customer from the beginning of the list would move the rest of the customers down, causing you to skip customers in your loop.
Your new class should not include a copy of the step
logic from the parent class. That logic remains unchanged, and may be
accessed using the super
keyword.
Since the line
instance variable is currently private in
the superclass, you will need to add an accessor method so that it can
be modified in your subclass.
Your class should include logic for tracking and reporting the number of customers that leave the line.
printResults
method so that it reports the total number of
customers that departed from all lines.
Aisle
subclass and modified MartSimulation
through canvas.
MartSimulation
class with the signature:
public void runMany(int numRuns)This method should run the simulation the indicated number of times, and calculate averages for each of the quantities reported.
main
that slowly increases the departure rate from 0 to 1 in increments of
.01. For each increment, run your simulation 100 times and report the
average results.