// purpose: represent a simple calculator public class Calculator { // attribute int runningTotal; // Calculator(): configures the running total to 0 public Calculator() { } // Calculator(): configures the running total to a given start value public Calculator( int startValue ) { } // add(): increments the running total by n public void add( int n ) { } // subtract(): decrements the running total by n public void subtract( int n ) { } // multiply(): scales the running total by n public void multiply( int n ) { } // divide(): if n is nonzero, divides running total by n. public void divide( int n ) { } // reset(): sets the running total to 0 public void reset() { } // equals(): test whether other calculator matches public boolean equals( Calculator other ) { return false; } // set(): sets the running total to n public void set( int n ) { this.runningTotal = n; } // value(): gives the current running total of the calculator public int value () { return this.runningTotal; } // toString(): produces a text representation of the running total public String toString() { String representation = "" + this.value(); return representation; } // equals(): tests whether there is a matching calculator public boolean equals( Object other ) { if ( other instanceof Calculator ) { return this.equals( (Calculator) other ); } else { return false; } } // clone(): return a new Calculator duplicating the calculator public Object clone() { int n = this.value(); Calculator c = new Calculator( n ); return c; } }