/** * file : AccountNumber.java * desc : Implements an account number for the virtual teller machine. * An account number is a Hashable object. */ import HashTable.*; public class AccountNumber implements Hashable { public AccountNumber( int newAcctNumber ) { acctNumber = newAcctNumber; } /** * post : returns this integer account number */ public int getNumber() { return acctNumber; } /** * post : returns a hash value that is >= 0, * based on this account number */ public int hashFunction() { return acctNumber; } /** * pre : otherKey is an AccountNumber * post : returns true <==> account numbers are equal */ public boolean equals( Object otherKey ) { AccountNumber otherAccount = (AccountNumber)otherKey; return (otherAccount.acctNumber == acctNumber); } private int acctNumber; // account number } // eof