CMSC 206 (Data Structures)

Assignment#3

Due:  October 3, 2012 11:59:59pm

The goal of this assignment is to develop your ability to do object-oriented programming, focusing specifically on inheritance and code reuse.


Introduction

In this assignment, you will complete a program that allows a user to repeatedly create and manage credit card accounts.  Your implementation should build directly on the CreditAccount class you created in the previous assignment.

You will write a program that allows a user to repeatedly create new credit accounts from three possible types: a standard account, a gold account, or a last-chance account.

To begin, download these two files:  Assignment3Skeleton.java and CS206Assignment3.jar.  The first (java) file is skeleton version of the program; start with this file and fill in the parts marked as "FIXME" to complete the assignment.  The second (jar) file is a completed version of the assignment that you can study.  To run this completed program, use the command java -jar CS206Assignment3.jar


Background on Credit Cards

When a new credit card account is opened, the credit company sets a credit limit for the user that specifies the maximum balance allowed on the account.  Unlike a debit card, the balance starts at $0.  The user can make purchases and charge them to the credit card, increasing the balance.  For example, if I charge two purchases of $100 and $50, my credit card balance would be $150.  Say that my credit limit is $500.  If I then tried to charge another $400 purchase to the card, the card would be declined since that would put the balance over my credit limit.  At the end of each month, the user must pay the entire balance on the card, or else the credit company charges the user interest on the balance.

Cashback (as given in the gold account) is money that the credit card pays you for making a purchase.  For example, if you make a $100 purchase on the card and get 2% cashback, your balance would increase by $100 - $2 = $98.


Program Requirements

Starting with the skeleton file provided above, you will modify the two parts marked as "FIXME" to complete the assignment. 

Here's an example trace of the program running once the assignment is complete.

Welcome to CS206 Credit Company

MAIN MENU
1.) Create a new account
2.) Log into an existing account
3.) Exit the banking system
Please enter your selection: 1

CHOOSE THE TYPE FOR THE NEW ACCOUNT
1.) Standard credit account
2.) Gold credit account
3.) Last-chance credit account
Please enter your selection: 1
Created new standard credit account #0 with a credit limit of $4000.00

STANDARD CREDIT ACCOUNT #0 MENU
1.) Get a balance on your account
2.) Charge your account
3.) Make a payment
4.) Log out
Please enter your selection: 2
Enter charge amount: 1000
Charged $1000.00        New balance $1000.00

STANDARD CREDIT ACCOUNT #0 MENU
1.) Get a balance on your account
2.) Charge your account
3.) Make a payment
4.) Log out
Please enter your selection: 3
Enter payment amount: 100
Charged interest $12.50
Received payment $100.00        New balance $912.50

STANDARD CREDIT ACCOUNT #0 MENU
1.) Get a balance on your account
2.) Charge your account
3.) Make a payment
4.) Log out
Please enter your selection: 4
Goodbye!

MAIN MENU
1.) Create a new account
2.) Log into an existing account
3.) Exit the banking system
Please enter your selection: 1

CHOOSE THE TYPE FOR THE NEW ACCOUNT
1.) Standard credit account
2.) Gold credit account
3.) Last-chance credit account
Please enter your selection: 2
Created new gold credit account #1 with a credit limit of $100000.00

GOLD CREDIT ACCOUNT #1 MENU
1.) Get a balance on your account
2.) Charge your account
3.) Make a payment
4.) Log out
Please enter your selection: 2
Enter charge amount: 1000
Received cashback reward of $20.00
Charged $1000.00        New balance $980.00

GOLD CREDIT ACCOUNT #1 MENU
1.) Get a balance on your account
2.) Charge your account
3.) Make a payment
4.) Log out
Please enter your selection: 4
Goodbye!

MAIN MENU
1.) Create a new account
2.) Log into an existing account
3.) Exit the banking system
Please enter your selection: 1

CHOOSE THE TYPE FOR THE NEW ACCOUNT
1.) Standard credit account
2.) Gold credit account
3.) Last-chance credit account
Please enter your selection: 3
Created new last-chance credit account #2 with a credit limit of $1000.00

LAST-CHANCE CREDIT ACCOUNT #2 MENU
1.) Get a balance on your account
2.) Charge your account
3.) Make a payment
4.) Log out
Please enter your selection: 2
Enter charge amount: 1000
Charged $1000.00        New balance $1000.00

LAST-CHANCE CREDIT ACCOUNT #2 MENU
1.) Get a balance on your account
2.) Charge your account
3.) Make a payment
4.) Log out
Please enter your selection: 3
Enter payment amount: 0
Charged interest $20.83
Missed payment. Increasing interest rate to 27%.
Received payment $0.00        New balance $1020.83

LAST-CHANCE CREDIT ACCOUNT #2 MENU
1.) Get a balance on your account
2.) Charge your account
3.) Make a payment
4.) Log out
Please enter your selection: 4
Goodbye!

MAIN MENU
1.) Create a new account
2.) Log into an existing account
3.) Exit the banking system
Please enter your selection: 3
Exiting Banking System


Implementation Hints


Submitting the Assignment

Be certain that all files contains proper header comments that include your name.

Place all .java and compiled .class files into a directory entitled LastnameFirstname-Assignment3.  This includes your CreditAccount.java and CreditAccount.class files from the previous assignment.

Make certain that your assignment will run when the command java Assignment3 is called from the terminal.

Compress the LastnameFirstname-Assignment3 folder as a zip or tar file, and submit it via Dropbox, as detailed in the assignment submission instructions.