CMSC 206 (Introduction to Computing)

Assignment#1

Part A Due:  September 07, 2011 11:59:59pm
Part B Due:  September 19, 2011 11:59:59pm
Part B Due:  September 21, 2011 11:59:59pm

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

To begin, download these two files:  Assignment1Skeleton.java and CS206Assignment1.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 CS206Assignment1.jar

Introduction

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.

  • A standard credit account has an annual interest rate of 15%, and an upper limit of $4,000.
  • A gold account has an annual interest rate of 10% and an upper limit of $100,000. In addition, gold card holders earn 2% cashback on every purchase.
  • A last-chance account is for people with a bad credit history. The annual interest rate is 25% and there is a $1,000 charge limit. However, a last chance card holder can get a better deal by consistently paying off the entire balance. If a last chance card holder pays off the balance three times in a row, then their interest rate drops to 20% and their limit increases to $1,500.  However, if they miss a payment (noted by a payment of 0), their interest rate will increase to 27%.


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

Part A

For part A of this assignment, you should complete the userMenu() method to make a functioning menu system.  However, to simply things, instead of actually acting on the accounts, simply print out the action the program would have taken if it were complete.  You should not need to modify any code outside of the userMenu() function to accomplish this.

This part is only to have you do some basic coding, compile the program, and submit it.  Don't worry about doing it wrong.  So long as you have some form of a functional user menu, you will get full credit for completing this part.  However, here is an example trace to give you an idea of what I'm looking for:

Welcome to CS206 Fall'11 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.0

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
TODO:  CHARGE THE CREDIT ACCOUNT

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
TODO:  MAKE A PAYMENT TO THE ACCOUNT


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: 1
TODO:  PRINT THE BALANCE ON THE ACCOUNT

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!

Part B

This second part is simply to complete the rest of the assignment, as described in the Introduction and Program Requirements listed above.  Here's an example trace of the program running once Part B is complete.

Welcome to CS206 Fall'11 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.0

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.0        New balance $1000.0

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.5
Received payment $100.0        New balance $912.5

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.0

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.0
Charged $1000.0        New balance $980.0

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.0

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.0        New balance $1000.0

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.0        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

Copy all your .java files for the project into a folder called Assignment01-PartA or Assignment01-PartB in dropbox before the deadlines.  I will provide more detailed descriptions on submitting files via dropbox shortly.




Acknowledgement:  This assignment was adapted from a lab assignment and materials provided by Andrew Danner.  All code was written by Eric Eaton.