CIS 400 Assignment 4
Fall 1999
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. 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.
2. Write a Smalltalk method that will compute the sum
of the data values stored in an array.
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 or Smalltalk
Express for this assignment. You may use any features of the
Smalltalk 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).
Assigned: 11-24-99
Due date: 12-08-99