package Calculator; public class EqualButtonObj extends ButtonObj { public EqualButtonObj( CalcTextGUI gui, CalculatorState stateObj ) { super( gui, stateObj ); } public void handleButton() { this.stateObj.doneReadingNumber(); double newOperand = ( this.gui.getValue() ); double newValue = this.stateObj .getPendingOperation() .doOperation( this.stateObj.getPreviousOperand(), newOperand ); this.gui.setText( String.valueOf( newValue ) ); if ( java.lang.Double.isInfinite( newValue ) ) { this.stateObj.setPreviousOperand( 0 ); } else { this.stateObj.setPreviousOperand( newValue ); } this.stateObj.resetPendingOperation(); } }