Spring Semester 2002
Write just objects, not object variables.
Rectangle r = (5, 10, 15, 20); double x = BankAccount(10000).getBalance(); BankAccount b; b.deposit(10000); b = new BankAccount(10000); b.addCoins(new Coin(0.25, "quarters")); Purse p = null; p.addCoins(new Coin(0.25, "quarters")); Purse p = new Purse(); p.addCoins(new Coin());
BankAccountclass. List all methods that can be used to change a
BankAccountobject. List all methods that don't change the
bafter the following operations?
BankAccount b = new BankAccount(10); b.deposit(5000); b.withdraw(b.getBalance() / 2);
b2store objects of class
BankAccount, consider the following instructions.
Are the balances ofb1.deposit(b2.getBalance()); b2.deposit(b1.getBalance());
b2now identical? Explain.
These are all questions from the book.