CIS 400 Assignment 3
Fall 1996
For your next assignment, you will need to complete the
following lab exercises using Smalltalk. I would prefer
receiving hardcopy of the relevant Smalltalk screens, but if
you are not able to this you may write your code and its
output as a lab report instead.
1. Send a series of messages to the Turtle object, which
will cause it to draw a square on the screen.
2. Find the factorial method in the Magnitude subclass
Integer. Use this as the model for a new recursive
method which will compute the sum of the numbers 0
through N.
3. Create a new object subclass called Account which
contains two instance variables name and balance.
Define a method which assigns values to name and
balance for new object instances; accessor functions
(methods) for retrieving the values of name and balance
for Account instances; and methods deposit and withdraw
to increment and decrement the value of balance.
I would prefer you to use SmallTalk/V for this
assignment. You may use any features of the language to
implement the objects and methods required by these
exercises. You will need to devise some experiments to
demonstrate that your code behaves correctly. You will need
to turn in clearly commented source listings of your
programs and any relevant computer output (no memo this
time).