Home Segments Index Top Previous Next

521: Mainline

Next, you need to implement a method, updateMonth, which increments the month whenever the value of the month instance variable is different from the delivery month associated with the first element on the event queue. Also, updateMonth adds a count of the rabbits to the history ordered collection whenever the month changes:

RabbitApplication method definition • instance 
updateMonth 
  [month < rabbits first deliveryMonth] 
    whileTrue: [history addLast: rabbits size. 
                month := month + 1]