CS 3304 Project #4

Date Assigned: November 21, 2003
Date Due: December 10, 2003, 11:59pm Eastern Time

Squeak your way into Smalltalk

This project will be an exploration into the Smalltalk language as well as the Squeak environment.

First take a look at John Maloney's Squeak tutorial and implement the BankAccount class. The entire project merely consists of inheriting from this class and adding new functionality, specifically:

  1. Create a subclass of BankAccount called SavingsAccount that has, in addition to the balance and history, an allotment of money in various categories. The allotment is an associative array involving (category, value) pairs. For instance, a sample allotment is: {('education',20),('marriage',30),('parking tickets',70),('Having Naren for teaching CS3304', priceless)}. Recall the lecture of Nov. 19, 2003 for how such an associative array can be implemented. The idea of allotment is to describe how the "balance" (from BankAccount) is distributed. So, if balance is $1000, and allotment is: {('education',10),('marriage',30)} then this means that 10/(10+30) of the balance is dedicated toward education, and the remaining 30/(10+30) of the balance is reserved for marriage costs. Or, in other words, there is three times more money reserved for marriage than education.

  2. SavingsAccount must support the following messages:
    • new which creates a SavingsAccount object, initializes balance to zero, and the history and allotment to empty lists.
    • initialize, which sets the balance to zero and initializes the history and allotment to empty lists (this is meant for use with an already created SavingsAccount object).
    • plansavings: factor for: reason adds an entry in allotment of (reason,factor).
    • showdistribution that plots a bar chart of money versus the categories in which it is allotted. For instance, when balance is $1000, and allotment is: {('education',10),('marriage',30)} then the bar chart will show two bars: one of height $250 for education and the other of height $750 for marriage.

  3. (Extra Credit: 15%) Implement a message pies in SavingsAccount that presents the percentage distribution of allotments in the form of a pie chart, with each slice of a different color and clearly labeled with the corresponding category.
When you are done with this project, save the SavingsAccount class according to the procedure described here.

Good Programming Style

Make sure you have comments in each message definition, explaining its purpose, the meaning of each parameter, and the general strategy of its implementation if applicable. 80% of the score comes from correct implementation and execution; 20% of the score comes from good OOP style, sound design, and good coding principles (comments, readability). And lastly, all work on this project is to be your own. There are no group projects in this course.

Demo'ing Your Project

For this project, no automatic grading feedback facility is available. Instead, you will demo your project to your GTA Saverio Perugini on either 12/10 (2-6p) or 12/11 (2-6p). You also may demo your project before these designated days during Saverio's regularly scheduled office hours. However, you will only be permitted to demo once. In other words, you cannot demo before the designated days in order to find your bugs and then demo again on one of the designated days after you have corrected them. All demos will take place in 133 McBryde and since we have a large number of demos to conduct, each demo will end promptly after 10 minutes. No demos will be conducted after 12/11 and all those students who have not demo'ed by then will receive no points. Saverio will keep a demo signup sheet with him at all times while in class and in office hours starting on 11/21.


Return
Home