All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class calculator.CalculatorState

java.lang.Object
   |
   +----calculator.CalculatorState

public class CalculatorState
extends 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

See Also:
Calculator

Variable Index

 o operation
 o previousNumber
 o readyForNewNumber
 o seenDecimal

Constructor Index

 o CalculatorState(Calculator)

Method Index

 o clearScreen()
 o doOperation(double)
 o handleDecimal()
 o handleEquals()
 o handleNumKey(int)
 o handleOperation(int)
 o readScreen()
 o resetCalc()
 o resetDecimal()
 o toString()
 o writeScreen(double)
 o writeScreen(int)
 o writeScreen(String)

Variables

 o seenDecimal
 protected boolean seenDecimal
 o readyForNewNumber
 protected boolean readyForNewNumber
 o previousNumber
 protected double previousNumber
 o operation
 protected int operation

Constructors

 o CalculatorState
 protected CalculatorState(Calculator gui)

Methods

 o toString
 public String toString()
Overrides:
toString in class Object
 o handleNumKey
 protected void handleNumKey(int num)
 o handleDecimal
 protected void handleDecimal()
 o handleOperation
 protected void handleOperation(int op)
 o handleEquals
 protected void handleEquals()
 o doOperation
 protected double doOperation(double currentNumber)
 o resetDecimal
 protected void resetDecimal()
 o clearScreen
 protected void clearScreen()
 o readScreen
 protected String readScreen()
 o writeScreen
 protected void writeScreen(String s)
 o writeScreen
 protected void writeScreen(double d)
 o writeScreen
 protected void writeScreen(int i)
 o resetCalc
 protected void resetCalc()

All Packages  Class Hierarchy  This Package  Previous  Next  Index