Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROGRAM : Bank Accounts: Using Classes with Constructors and Methods You have been hired as a programmer by a major bank. Your first project

JAVA PROGRAM : Bank Accounts: Using Classes with Constructors and Methods

You have been hired as a programmer by a major bank. Your first project is a small banking transaction system. Each account consists of a number and a balance. The user of the program (the teller) can create a new account, as well as perform deposits, withdrawals, balance inquiries, close accounts, etc.

For this assignment, you must use Classes and move functionality into the classes. Specifically, you should have at least the following classes: 1. A Bank class which consists of an array of Accounts and the number of accounts currently active in the bank. 2. An Account class which consists of a Depositor, an account number, an account type, and a balance. 3. A Depositor class which has a Name and a social security number. 4. A Name class which consists of first and last names. 5. A DateInfo class which consists of year, month, and dayOfMonth data members.

You must add appropriate methods to each class so as to implement the functionality of each of the methods of the previous assignment (HW2). Each of the methods of HW2 should be re-implemented utilizing a class method. (You will have to decide as to which class each method belongs.) In addition, each class should minimally have a default constructor and possibly additional parametized constructors. (Some of the HW2 methods may become constructors.)

The data members of each class must be private. As such, you may need to provide accessor and mutator methods.

Remember, all I/O should be done only in the methods of the class that contains the main() method.

As in previous assignments, initially, the account information of existing customers is to be read into the database. The bank can handle a maximum of MAX_NUM accounts. The program keeps tracks of the actual number of currently active accounts. A table of the initial database of active accounts should be printed.

As before, the program then allows the user to select from the following expanded menu of transactions:

Select one of the following:

W - Withdrawal

D - Deposit

C - Clear Check

N - New account

B - Balance

I - Account Info

X - Delete Account

Q - Quit

Note 1: The Clear Check transaction is only valid for checking accounts. It is like a withdrawal; except, you must also check the date of the check. You may only clear a check if the date on the check is no more than six months ago. No post-dated checks (checks with a future date) may be cleared. Use the DataeInfo class to implement this. In addition, a check will clear only if there is sufficient funds in the account. If the account lacks sufficient funds, the check will not clear and the account will be charged a $2.50 Service Fee for bouncing a check.

Note 2: CD accounts will now contain a Maturity Date. Deposits and Withdrawals will be allowed only on or after the maturity date. When a deposit or withdrawal is made, have the user select a new maturity date fro the CD. the choices are either 6, 12, 18, or 24 months from the date of the deposit or withdrawal. Again, use the DateInfo class to implement this.

Note 3. Use the Calendar class to assist you in implementing the DateInfo class.

Once the user has entered a selection, appropriate methods (in the class that contains the main() method) should be called to perform the specific transaction. These methods will call the class implemented methods as necessary. At the end, before the user quits, the program prints the contents of the final database.

As in previous assignments, make sure to use enough test cases so as to completely test program functionality. Make sure that there is at least one depositor that has multiple accounts at the bank.

Minimal Class Requirements:

1a. The Bank class should at least have a default constructor that would allow statements of the form: Bank bank = new Bank();

1b. The Bank class should have at least have the following methods:

public int openNewAcct(...) (return value indicates success or reason for failure)

public int deleteAcct(...) (return value indicates success or reason for failure)

public int findAcct(...) (return value indicates index of found Account or reason for failure)

public Account getAcct(...)

public void setAcct(...)

2a. The Account class should at least have a constructor that would allow statements of the form:

Account myAccount = new Account(...); //or account[i] = new Account()

2b.

The Account class should have at least the following methods:

public double getBalance(...)

public int makeDeposit(...) (return value indicates success or reason for failure)

public int makeWithdrawal(...) (return value indicates success or reason for failure)

public int clearCheck(...) (return value indicates success or reason for failure)

public Depositor getDepositor(...) public int getAcctNumber(...)

public String getAcctType(...) public void setDepositor(...)

public void setAcctNumber(...)

public void setAcctType(...)

3a.

The Depositor class should at least have a constructor that would allow statements of the form:

Depositor depositor = new Depositor(...);

3b.

The Depositor class should at least the following methods:

public Name getName(...)

public String getSSN(...)

public void setName(...)

public void setSSN(...)

4a. The Name class should at least have a constructor that would allow statements of the form:

Name name = new Name(...);

4b. The Name class should at least the following methods:

public String getFirstName(...)

public String getLastName(...)

public void setFirstName(...)

public void setLastName(...)

5a. The DateInfo class should at least have a constructor that would allow statements of the form:

DateInfo date = new DateInfo(...);

5b. The DateInfo class should at least the following methods:

public int compareDate(...) //used to compare two DateInfo objects - returns signal to indicate result of comparison public int getYear(...)

public int getMonth(...)

public int getDayOfMonth(...)

public void setYear(...)

public void setMonth(...)

public void setDayOfMonth(...)

6. Add additional constructors and methods to each class as necessary.

7. The class containing the main() method should have at least the following methods:

public static void main(String[] args)

public static int readAccts(...)

public static void printAccts(...);

public static void menu(...)

public static void balance(...);

public static void deposit(...);

public static void withdrawal(...);

public static void clearCheck(...);

public static void acctInfo(...);

public static void newAcct(...);

public static void deleteAcct(...);

8. All I/O should be done only in the methods of the class that contains the main() method.

This assignment is a continuation of the previous assignment, https://www.chegg.com/homework-help/questions-and-answers/hired-programmer-major-bank-first-project-small-banking-transaction-system-account-consist-q34844652?trackid=AEKBiWSF

If possible, may I also see a sample of the output, it is very much appreciated. Thank you.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions