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, 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
Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.