This is the fifth graded lab for CS2102.
If you are in the Lab, perform the routine KH 202 setup or AK 120D setup; for now, ignore the "advanced setup" options. If you would like to set up Eclipse on your personal computer, then (a) install Java JDK 1.5 if you need to as described in tools section (here); and (b) install Eclipse as described in tools section (here).
Get the skeleton LabStack files within the Examples folder in Eclipse/SourceForge under the package lab5. I copy the file below for your convenience.
Create a new class LabStack that will perform as a "Last-in, First-out" stack. Imagine a stack of trays in the cafeteria. To add a try to the stack, you place it on top (an action known as push) of the stack. To remove a tray from the stack, you remove the top-most one (an action known as pop).
Your LabStack class must implement the following methods:
package lab5;
import java.util.*; /** Store all information using
an ArrayList. */ /** Define the constructor. */ /** /** /** /** } |
Once you have completed the LabStack class, then try out the simple calculator that uses LabStack, which can be found in the Eclipse/Examples directory under lab5/Calculator.java.
See if you can modify this class to support '*' (multiplication), '/' (division), and '-' (subtraction).
Date | Reason/Change |
12/06/06 | Final Page |