import tester.ISame; /** * This class represents a bank account with owner, * kind (checking, savings, or a credit line) and * the current balance. */ class Acct implements ISame{ /** the owner of this account */ String owner; /** the kind of this account: checking, savings, or a credit line*/ String kind; /** the current balance in this account */ int balance; /** * Full constructor * @param owner account owner * @param kind one of checking, savings, or credit * @param balance the curren balance */ Acct(String owner, String kind, int balance){ this.owner = owner; this.kind = kind; this.balance = balance; } /* TEMPLATE: FIELDS: ... this.owner ... -- String ... this.kind ... -- String ... this.balance ... -- int METHODS FOR FIELDS: ... this.owner.equals(String) ... -- boolean ... this.kind.equals(String) ... -- boolean METHODS FOR THIS CLASS: ... this.same(Acct) ... -- boolean */ /** * Is this account the same as the given one? * @param that the given account * @return true if the accounts are the same */ public boolean same(Acct that){ return this.owner.equals(that.owner) && this.kind.equals(that.kind) && this.balance == that.balance; } }