S428/S528 Spring 2005 Assignment 4

Due by midnight, Sunday Apr 17, 2005

This assignment is INDIVIDUAL and not a team assignment!

Goal of this assignment

Remember the BankAccount assignment you did for Assignment 2? In this assignment, you will upgrade your program to use JDBC and store all the data in a database so that the information is not lost when you close the application. The following are explicit requirements in this assignment for everyone:

S528 Students: You will also need to use inheritance, polymorphism, abstract classes, and interfaces (as appropriate) to implement a full-scale checking and savings account. The following are the differences in the assignment for S528 students only:

  1. Each user should have two accounts, a savings and a checking account.
  2. When a user successfully logs in, he/she will be automatically sent to the account menu. By default, the users will be using the checking account, and in this menu, they can switch to a different (savings) account, check balance, add deposit, make purchases, get list of transactions, and log out.
  3. The new functionalities include:
    1. Switching accounts - the user can change the current account to his/her other account (so from savings to checking or vice versa).
    2. For checking accounts, the user can write a check, in which case he/she is prompted for a check number, payee, and amount.
    3. For checking accounts, if an account is overdrawn, an automatic transfer is made from the savings account for the arrears to bring the balance to zero. The savings account is charged an overdraft fee of $1.00 if that happens.
    4. For savings accounts, there is no overdraft, but the user can see the amount of interest that he/she will earn (he/she does not actually get this amount added, but this is just a calculation that returns the amount which is 2.5% of the current savings balance.
  4. Error conditions: Several error conditions can arise, such as:
    1. The amount of deposit, withdrawal, or check is negative
    2. The number of transactions exceeds the maximum allowed per account
    3. The savings account is overdrawn. (Note that the checking account has overdraft protection, but the savings account doesn't). Also note that it is possible that the savings account does not have enough funds to cover the balance and the overdraft fee, in which case the withdrawal is rejected.

The following is a sample run of the system (for s528 students only - for s428 students, the program run will look the same as that in Assignment 2):

Welcome to my ATM! Please Swipe your Card! Enter negative number to exit.

Enter ATM Number:  1234
New User! Your name is:  Jit
Your PIN:  asdf
Invalid PIN!
Your PIN:  345678
Invalid PIN!
Your PIN:  3456
Your default currency: USD
Your default currency is set to United States Dollars (USD).

You are using your checking account.

Hello, Jit! Your options are:
	0. Switch to savings account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Write a check
	6. Log out
Your choice:  1
Your balance is USD 0.00

Hello, Jit! Your options are:
	0. Switch to savings account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Write a check
	6. Log out
Your choice:  2
Amount of funds to add:  500
Currency of deposit: USD

Your balance is USD 500.0

Hello, Jit! Your options are:
	0. Switch to savings account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Write a check
	6. Log out
Your choice:  3
Purchase amount:  75.50
Purchase currency:  USD
Purchase purpose:  grocery

Your balance is  USD 424.50


Hello, Jit! Your options are:
	0. Switch to savings account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Write a check
	6. Log out
Your choice:  5
Check no :  101
Payee: Electric Company
Check amount :  34.56
Check currency: USD


Hello, Jit! Your options are:

	0. Switch to savings account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Write a check
	6. Log out
Your choice:  4
1. Deposit		USD 500.0
2. grocery		(USD 75.5)
3. Check # 101 to: Electric Company	(USD 34.56)


Hello, Jit! Your options are:

	0. Switch to savings account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Write a check
	6. Log out
Your choice:  1
Your balance is USD 389.94


Hello, Jit! Your options are:

	0. Switch to savings account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Write a check
	6. Log out
Your choice:  0
You are now using your Savings Account.


Hello, Jit! Your options are:

	0. Switch to checking account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Find Interest Income
	6. Log out
Your choice:  1
Your balance is USD 0.0


Hello, Jit! Your options are:

	0. Switch to checking account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Find Interest Income
	6. Log out
Your choice:  2
Amount of funds to add:  300
Currency of deposit: USD
Your balance is USD 300.0


Hello, Jit! Your options are:

	0. Switch to checking account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Find Interest Income
	6. Log out
Your choice:  5
Your current interest earling is: USD 7.50


Hello, Jit! Your options are:

	0. Switch to checking account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Find Interest Income
	6. Log out
Your choice:  0
You are now using your Checking Account.


Hello, Jit! Your options are:

	0. Switch to savings account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Write a check
	6. Log out
Your choice:  5
Check no: :  102
Payee: :  Credit Card co.
Check amount: :  400
Check currency: USD


Hello, Jit! Your options are:

	0. Switch to savings account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Write a check
	6. Log out
Your choice:  1
Your balance is USD 0.0


Hello, Jit! Your options are:

	0. Switch to savings account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Write a check
	6. Log out
Your choice:  4
1. Deposit		USD 500.0
2. grocery		(USD 75.5)
3. Check # 101 to: Electric Company	(USD 34.56)
4. Deposit		USD 10.06
5. Check # 102 to: Credit Card co.	(USD 400.0)


Hello, Jit! Your options are:

	0. Switch to savings account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Write a check
	6. Log out
Your choice:  0
You are now using your Savings Account.


Hello, Jit! Your options are:

	0. Switch to checking account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Find Interest Income
	6. Log out
Your choice:  4
1. Deposit		USD 300.0
2. Overdraft transfer to Checking		(USD 10.06)
3. Overdraft fee		(USD 1.0)


Hello, Jit! Your options are:

	0. Switch to checking account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Find Interest Income
	6. Log out
Your choice:  1
Your balance is USD 288.94


Hello, Jit! Your options are:

	0. Switch to checking account
	1. Check Balance
	2. Add Funds
	3. Make a purchase
	4. View Transactions
	5. Find Interest Income
	6. Log out
Your choice:  6
Welcome to my ATM! Please Swipe your Card! Enter negative number to exit.

Enter ATM Number:  -1
Bye!

Your implementation should have the BankApplication.java file (and any other java file you feel necessary).

What to hand in

Name the main class in this assignment BankApplication.java. You will most likely have several other class files. You will need to hand in all the java files you use in this assignment. You will also need to hand in a file BankApplication.doc containing an UML class diagram that captures your design. You will also need to turn in an SQL file BankApplication.sql containing the SQL scripts that create your tables. Make sure that your program works with your Oracle database on dbserv.uits.indiana.edu - if you use a different database test your program with dbserv before turning in.

Submission method You will need to submit your assignment using the online submission system. To submit, use the following steps: