Calculator Object A simple calculator class for performing basic arithmetic operations. # int currentValue # int initialValue init Initializes the calculator with an initial value. # currentValue = # initialValue # int operand add # Adds the given operand to the current value. # currentValue = # currentValue + # operand return # currentValue # int operand subtract # Subtracts the given operand from the current value. # currentValue = # currentValue - # operand return # currentValue # int operand multiply # Multiplies the given operand by the current value. # currentValue = # currentValue * # operand return # currentValue # int operand divide # Divides the given operand by the current value. # currentValue = # currentValue / # operand return # currentValue # float value storeMemory Stores the specified value in the calculator's memory. # memory = # value recallMemory # Recalls the stored memory value. return # memory $ string displayText updateDisplay Updates the Calculator UI with the provided display text. ƒ setDisplayValue $ displayText handleButtonPress Processes UI button press events for digit and operation inputs. $ input = ƒ readButtonInput ƒ processInput $ input # int percentValue calculatePercentage # Calculates the new current value after applying a percentage adjustment. # currentValue = # currentValue * # percentValue / 100 return # currentValue
    Key Commands
    Selection Info