Calculator Problem Set Javadocs

calculator
Class CalculatorState

java.lang.Object
  extended bycalculator.CalculatorState

public class CalculatorState
extends java.lang.Object

This class provides the main functionality for a basic four-function calculator. Adapted from the earlier ButtonHandler

Copyright (c) 1999 Massachusetts Institute of Technology

Version:
$Id: CalculatorState.java,v 1.2 2003/03/28 17:25:06 gus Exp $
Author:
Todd C. Parnell, tparnell@ai.mit.edu, Emil Sit, sit@mit.edu, Lynn Andrea Stein, las@ai.mit.edu
See Also:
Calculator

Field Summary
protected  int operation
           
protected  double previousNumber
           
protected  boolean readyForNewNumber
           
protected  boolean seenDecimal
           
 
Constructor Summary
protected CalculatorState(Calculator gui)
           
 
Method Summary
protected  void clearScreen()
           
protected  double doOperation(double currentNumber)
           
protected  void handleDecimal()
           
protected  void handleEquals()
           
protected  void handleNumKey(int num)
           
protected  void handleOperation(int op)
           
protected  java.lang.String readScreen()
           
protected  void resetCalc()
           
protected  void resetDecimal()
           
 java.lang.String toString()
           
protected  void writeScreen(double d)
           
protected  void writeScreen(int i)
           
protected  void writeScreen(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

seenDecimal

protected boolean seenDecimal

readyForNewNumber

protected boolean readyForNewNumber

previousNumber

protected double previousNumber

operation

protected int operation
Constructor Detail

CalculatorState

protected CalculatorState(Calculator gui)
Method Detail

toString

public java.lang.String toString()

handleNumKey

protected void handleNumKey(int num)

handleDecimal

protected void handleDecimal()

handleOperation

protected void handleOperation(int op)

handleEquals

protected void handleEquals()

doOperation

protected double doOperation(double currentNumber)

resetDecimal

protected void resetDecimal()

clearScreen

protected void clearScreen()

readScreen

protected java.lang.String readScreen()

writeScreen

protected void writeScreen(java.lang.String s)

writeScreen

protected void writeScreen(double d)

writeScreen

protected void writeScreen(int i)

resetCalc

protected void resetCalc()

Calculator Problem Set Javadocs