In this lab, modify the Museum simulation which is included in the MuseumSimulation.cs found in
Chapters 23 and 24 of the Smalltalk-80 textbook. We will modify the
Museum to have more people in the museum than just visitors.
Add volunteers and staff.
Your simulation should keep track of the number of people in the museum
at each time interval, where the number of people includes staff,
volunteers, and visitors. Have your simulation be able to output the
maximum number of people at any time.
Hint: Either during the enter: method or on the
simulation object's initialize: method, increment a count of
people. At exit:, decrement the number of people.
Also, be careful of the syntax used for some of the classes in the
Simulation package. For the entry of people, you may use the following
methods:
scheduleArrivalOf:at:
Make sure you understand how these work and what can and cannot be passed
to them. The statistical information should be included in the package,
so you don't have to worry about that. Look at how the functions are
implemented in the other simulation classes to get an idea of how to do
it.
To run the simulation provided, use the code below:
Note: If Squeak is stalling on the whileTrue: loop, you can exit
it by pressing CTRL-Break simultaneously. The Break key is the
right-most key on the top-most keyboard line.
scheduleArrivalOf:accordingTo:
scheduleArrivalOf:accordingTo:startingAt:
| aSimulation |
aSimulation := Museum new startUp.
[aSimulation time < 480] whileTrue: [aSimulation proceed]. "480
minutes, all day"
Transcript show: 'Maximum: ', (aSimulation maximum printString) ;
cr.
What to turn in
File out the code you wrote and copy the text of the fileout, paste this
text into the BODY of an email message to your TA. Subject as normal.