SDSU CS 635 Advanced Object-Oriented Design & Programming
Spring Semester, 2002
Assignment 5
    Assignment Index        
© 2002, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 09-Apr-02

Assignment 5 – Undo

Due April 25

The goal of this assignment is to study the patterns that are related to undo.

We will use the operations add first, add last, remove nth and reverse on ordered collections. The actual type of collection you use will depend on the language you are using: OrderedCollection in Smalltalk, ArrayList in Java, and the equivalent in C++.

Create a program that contains two menus: “File” and “Edit”.
File Menu

The “File” menu will manage a group of collections. The “File” menu will have the following menu items: “New”, “Make Active...” and “Print”.

The “New” menu item will create a new empty collection and make it the active collection. When a new collection is created, it is given a creation number that does not change.

The “Make Active...” menu item will prompt the user for a number between 1 and N, where N is the current number of collections created with the “New” menu item. The number given by the user indicates the creation number of the collection to make active.

The “Print” menu item will print (display) the contents of the active collection on an output device of your choice. This will make it easier for you to determine if your program is working.

Edit Menu

The “Edit” menu is used to modify the contents of the active collection. This menu has the items: “Add Last...”, “Add First..”, “Remove...”, “Reverse”, “Undo” and “Redo”. All these operate on the collection that is currently active.

The “Add Last...” menu item prompts the user for a string. This string is added at the end of the collection. Note this means that this is a collection of strings, not one string.

The “Add First...” menu item prompts the user for a string. This string is added at the front of the collection.

The “Remove ...” menu item prompts the user for a number. This number is the index of the item in the active collection to remove.

The “Reverse” menu item reverses the order of the elements in the active collection.

The “Undo” menu item undoes the last edit operation done on the active collection. This can be repeated to undo all the edit operations done on the active collection. One cannot undo the creation of a collection. The “Undo” menu item does not change any collection that is not active. One could create collection 1, perform edits on the collection, create collection 2, perform edits on the second collection, make the first collection active, and perform some more edits on the first collection. Repeated use of the “Undo” would undo all the edits of the first collection (which is currently active) and not change the second collection.

The “Redo” menu item redoes the last action that was undone on the active collection. This can be repeated to redo all the undone operations on the active collection. When one performs a new action from the menu, the redo buffer on the active collection is flushed.

Grading


Percent of Grade
Working Code
10%
Unit Tests
15%
Quality of Code
25%
Proper implementation of Patterns
50%




Copyright ©, All rights reserved.
2002 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.

    visitors since 09-Apr-02