Lab 4 - Bank Account Manager

tellers

Introduction

A local bank offers various types of accounts, some of which accrue interest and others that do not.

For simplicity's sake we will have interest compounded once at the end of each month.

You will implement bank account classes that will track instances of the various types of accounts through various events.

The code we provide creates and works with bank accounts over multiple months, performing the following actions.


Getting Started

By now you should have fetched starter code from the shared Git repository whose URL your instructor or SLI gave you, and started on the implementation described below.


Implementation

Now that you have had some experience designing your own classes, we want you to implement a solution using our design. You will finish the implementation of the parent abstract BankAccount class. You will also implement three account subclasses: CheckingAccount, CDAccount, and CreditCard.

A text file with a skeleton implementation of BankAccount is included.

The SavingsAccount class is provided as an example.

A Currency class is included so you don't have to think about calculating with dollars and cents.

As you saw from the problem solving session, all account types have a lot in common. One commonality is that all accounts must report the amount of interest paid. We will designate that method to be abstract because we don't know how each account will calculate the interest - we'll leave that to the implementing class to specify.

We are using an exception class InsufficientFunds to be thrown when a withdrawal on a debit account would cause its balance to go below zero or a charge on a credit account would cause the balance to exceed the credit limit. Here is the syntax for throwing a simple exception in Java.

    throw new InsufficientFunds();

All interest rates are constants in the various classes. We assume that a statement period is a month, thus the value of BankAccount.NUM_PERIODS_PER_YEAR.

You are provided with three test programs that will test your implementation. If you look at the comments at the end of each test's source file, you will see the expected output. For formatting issues, see the Handy Tips section below.

Design Details

These classes and their relationships can be visualized in the following UML diagram. Notice that we are showing you a bit of the recommended state for each of the classes. There is more that you must add in the form of private fields. In the diagram, generated by IntelliJ IDEA, the opened lock means public, the key means protected, and if there were any locked locks, those would designate private features. Note that the superclass has some protected methods that keep the class from having any protected fields. This practice improves encapsulation.

The black-on-orange f's represent fields. The tiny pin on the upper left means final (constant) and the diamond on the bottom left means static.


UML Belongs Here

Documentation

Take a moment to familiarize yourself with the program design by reviewing the javadocs. You will note that in that documentation some of the classes are in the bank package and others are in the student package. Those in the latter package contains the classes you are to implement. Look at the documentation to find out more details of how things are to work.

Handy Tips

One hard-to-notice item that may be handy is the constant ZERO in the Currency class.

The constant CheckingAccount.PREMIUM_CHECKING_MINIMUM_BALANCE is $500.00. The constant CDAccount.MINIMUM_BALANCE is $1000.00. They does not show up in the generated documentation.

To compute the monthly interest rate, divide the appropriate annual interest rate constant by NUM_PERIODS_PER_YEAR.

Formatted printing can be achieved with the printf method in PrintStream, the class to which System.out belongs. See the sample output in the test files' comments for formatting. Currency objects format themselves, so all that is left is the spacing of the strings. However, we will not be deducting grade points if the output does not match exactly with respect to spacing.


Submission

Zip together all your java source files into a file called lab04.zip. This file must be in zip format.

Submit your file to the MyCourses dropbox for this assignment.

Push your work to your github repository as well.


Grading

The grade breakdown for this lab is as follows: