The Stack Pictures laboratory is designed to provide students with exposure to the Stack data structure. The traditional methods of a Stack are specified in an ADT encapsulated in a Java interface. The student writes two implementations of the ADT: one built using the dynamic array design pattern, and one built by adapting a Java Vector using delegation.
Implementations are tested in an environment where a number of independent stacks, containing Color objects, are placed next to each other to form a picture. Within the graphical user interface, students can also view the picture as drawn by an implementation known to be correct. The application is capable of displaying stacks as push-down (the cafeteria tray metaphor) or pile-up (the office inbox metaphor).
A screen snapshot from the laboratory is available below.
The Stack Pictures Laboratory Description in Microsoft Word
The Stack Pictures Laboratory Description in Adobe PDF
All Stack Pictures Laboratory Files in zip format
All Stack Pictures Laboratory Files in Windows self-extracting format
The Java file StackPicturesApplication.java
The Java file StackADT.java
The Java file ArrayStack.java
The Java file StackEmptyException.java
The Java file StackFullException.java
The Java file ColorPanel.java
The Java file ColorStack.java
The Java file ColorStackView.java
The Java file ColorStackGrid.java
The data file all-white.stack
The data file rainbow.stack
The data file flower.stack
Jeff Raab
Instructor of Computer Science
jmr@ccs.neu.edu
College of Computer Science
161 Cullinane Hall
Northeastern University
Boston, MA 02115
Phone: 617-373-2206
Fax: 617-373-5121