Due in class, Monday, March 4, 2002
Purpose: To become familiar with the Squeak programming environment; to practice writing your own Smalltalk classes; to become familiar with the Morphic framework.
initialize " initalize the instance variables " enqueue: anItem " add the given item to the end of the queue " dequeue " answer the item at the head of the queue. error if no such item. " size " answer the number of elements in the queue " do: aBlock " evaluate aBlock with each element in the queue "Your queue should have one instance variable (items) which will hold the items in the queue. You may use any collection you find appropriate to hold the items. (HINT: check out OrderedCollection...)
initialize: name " initialize the account with the given name and a zero balance " deposit: amount " deposit the given amount into the account " withdraw: amount " withdraw the given amount from the account, error if insufficient funds " balance " answer the account balance " owner " answer the account owner "Your class will probably require a couple of instance variables, for balance and account owner (a string).
There are lots of ways to do this, but its probably quickest to override the initialize and bounceIn methods. You'll also need to make a few modifications to the BouncingAtomsMorph class.
Of course, if you're keen, you can add sound effects or even other classes that have different behaviors. The more you learn about the Morphic framework, the easier time you will have completing the project!
In the past, we've asked new Smalltalkers to write a haiku reflecting their smalltalk experience, for instance:
smalltalk is a brook become a torrent in the heavy rains drowning small childrenor
i ride a turtle into object nirvana self become: nilContinuing this tradition, we ask you to write your own haiku.
Deliverables:
We'd like you to turn in the following (hard copies only).