package calculator; public class CalcModel { private int calcValue; /** * Creates a model with no user values and a calculated value of zero. * */ public CalcModel() { this.calcValue = 0; } /** * Clears the user values and the calculated value. */ public void clear() { this.calcValue = 0; } /** * Adds the calculated value by a user value. * * @param userValue * The value to add to the current calculated value by. */ public void sum(int userValue) { this.calcValue += userValue; } /** * Subtracts the calculated value by a user value. * * @param userValue * The value to subtract from the current calculated value by. */ public void subtract(int userValue) { this.calcValue -= userValue; } /** * Multiplies the calculated value by a user value. * * @param userValue * The value to multiply the current calculated value by. */ public void multiply(int userValue) { this.calcValue *= userValue; } /** * Divides the calculated value by a user value. * * @param userValue * The value to multiply the current calculated value by. * @pre. userValue is not equivalent to zero. */ public void divide(int userValue) { this.calcValue /= userValue; } /** * Get the current calculated value. * * @return The current calculated value. */ public int getCalcValue() { return this.calcValue; } }