### Problem 2

A bank offers an Account to its customers. An Account is used to store, deposit, and withdraw funds, as well as apply interest. An Account earns 1% interest for the balance over \$1000. The bank also offers a PremiumAccount which is the same as an Account except that the account earns 1.5% interest on the entire balance.

Do the following:

• Model this situation with a class diagram that uses inheritance and overriding. You will add to this diagram for Problem 3. You may draw this by hand, neatly. Or you can use free software like Umlet.
• Write the required classes.
• Write a tester, AccountTester.java and test your classes thoroughly.

### Problem 3

Continuing from Problem 2, we want to model the situation where a Person can have many accounts (any combination of Accounts and PremiumAccounts).

The Person class should have these methods:

• addAccount( a : Account ) Adds the account a to the Person
• getAccount( i : int ) : Account Return the ith account. No error checking required.
• getNumAccounts() : int Returns the number of accounts.
• getTotalBalance() : double Returns the total balance added over all the accounts the person has.
• applyInterest() applies interest to every account the person has.
• toString() : string Returns a string like this:

Num Accounts: 3
bal = 2234.34
bal = 4523.29
bal = 45.62
Total Balance = 6803.25