![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
To enable reporting, you first modify the RabbitApplication
class
and the initialize
method to include and initialize two additional
instance variables.
The month
variable is to keep track of the current month in the
simulation; the history
variable is to keep track of the number of
rabbits after each month has passed, starting with month 0
. Key
changes are marked by change bars, .
RabbitApplication class definition Object subclass: #RabbitApplication instanceVariableNames: 'rabbits month history' classVariableNames: '' poolDictionaries: '' RabbitApplication method definition instance initialize month := 0. history := OrderedCollection new. rabbits := SortedCollection sortBlock: [:x :y | x deliveryMonth < y deliveryMonth]. rabbits add: (Rabbit new deliveryMonth: 2)