/** * A simple class equivalent to integers. * * @author Samuel A. Rebelsky * @author Yvonne Palm * @author Jonathan Wellons */ public class MyInteger implements Multipliable { // +--------+--------------------------------------------------- // | Fields | // +--------+ int value; // +--------------+--------------------------------------------- // | Constructors | // +--------------+ /** * Create a new MyInteger with specified value. */ public MyInteger(int value) { this.value = value; } // MyInteger(int) // +----------------+------------------------------------------- // | Public Methods | // +----------------+ /** * Multiply. Duh. */ public Multipliable multiply(Multipliable other) { return new MyInteger(this.value * ((MyInteger) other).value); } // Multiply(Multipliable) /** * Convert to a string for printing. */ public String toString() { return Integer.toString(value); } // toString() } // class MyInteger