Rice University - Comp 212 - Intermediate Programming

Spring 2004 - Lab 12 - Application of the State Design Pattern to Finite State Machines


In this lab we will complete the construction of a Graphical User Interface ("GUI") "Cheap Calculator" discussed in lecture #33.

State Transition Diagram

 

Model-View Design

Here is the UML diagram of the complete system that we will be building:

The documentation for the above classes can viewed here.

You may download the code for InFixCalc and the partially completed GUI code here: AFrame.java & InfixGUI.java (put them in a package called "infixView")

Let's get started! Remember to do the following parts in order:

Step 0: Understand the problem

Study the above state transition diagram!

Step 1: Add Operator Classes

Step 2: Add Concrete States

Step 3: Add More Buttons and Operations

Step 4: Model-View-Controller Design