/** * A virtual Husky Card Specification. * CSE142 lecture example 1/14/04, 1/16/04. */ public class HuskyCard { // instance variables private String name; // card holder's name private int id; // ID number private int balance; // account balance in pennies /** * Construct a new HuskyCard with a balance of 0 * @param ownerName the owner's name * @param idNumber the owner's id number */ public HuskyCard(String ownerName, int idNumber) { name = ownerName; id = idNumber; balance = 0; } /** * Return this HuskyCard's owner's name * @return owner's name */ public String getName() { return name; } /** * Return the ID number associated with this HuskyCard * @return the HuskyCard owner's ID number */ public int getID() { return id; } /** * Report the current balance of this HuskyCard * @return the current balance in pennies */ public int getBalance() { return balance; } /** * Deposit money into this HuskyCard * @param amount the amount to deposit in pennies */ public void deposit(int amount) { balance = balance + amount; } /** * Withdraw money from this HuskyCard * @param amount the amount to withdraw in pennies */ public void withdraw(int amount) { balance = balance - amount; } /** * Change the name on this HuskyCard * @param newName new name for card owner */ public void setName(String newName) { name = newName; } }