Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Initially, the account information of existing customers is to be read into an array of BankAccount objects. The private data members of the BankAccount Class will include: first name, last name, social security number, account number, account type (Checking, Savings, or CD), and account balance. The bank can handle up to MAX_NUM accounts. Use the following function to read in the data values:

public static int readAccts(BankAccount[] account, int maxAccts); This method fills up the array (up to maxAccts) and returns the actual number of accounts read in (referred to as numAccts). After initialization, print the initial database of accounts. Use method printAccts() described below. The program then allows the user to select from the following menu of transactions:

Select one of the following:

W - Withdrawal

D - Deposit

N - New account

B - Balance

I - Account Info

X - Delete Account

Q - Quit

Use the following method to produce the menu: public static void menu() This method only displays the menu. The main program then prompts the user for a selection. You should verify that the user has typed in a valid selection (otherwise print out an error message and repeat the prompt).

Once the user has entered a selection, one of the following methods should be called to perform the specific transaction. At the end, before the user quits, the program prints the contents of the database.

public static int findAcct(BankAccount[] account, int numAccts, int reqAccount); This method returns the index of reqAccount in the array account if the account exists, and -1 if it doesn't. It is called by all the remaining methods.

public static void withdrawal(BankAccount[] account, int num_accts); This method prompts the user for the account number. If the account does not exist, it prints an error message. Otherwise, it asks the user for the amount of the withdrawal. If the account does not contain sufficient funds, it prints an error message and does not perform the transaction

public static void deposit(BankAccount[] account, int num_accts); This method prompts the user for the account number. If the account does not exist, it prints an error message. Otherwise, it asks the user for the amount of the deposit.

public static int newAcct(BankAccount[] account, int num_accts); This method prompts the user for a new account number. If the account already exists, it prints an error message. Otherwise, it adds the account to the database. The method then prompts the user to enter the new depositors first name, last name, social security number, the account type (Checking, Savings, or CD), and the initial opening deposit.. The method returns the new number of accounts in the database.

public static int deleteAcct(BankAccount[] account, int num_accts); This method prompts the user for an account number. If the account does not exist, or if the account exists but has a non-zero balance, it prints an error message. Otherwise, it closes and deletes the account. It returns the new number of accounts.

public static void balance(BankAccount[] account, int num_accts); This method prompts the user for an account number. If the account does not exist, it prints an error message. Otherwise, it prints the account balance.

public static void accountInfo(BankAccount[] account, int num_accts); This method prompts the user for a social security number. If the account does not exist, it prints an error message. Otherwise, it prints the complete account information for the account requested

public static void printAccts(BankAccount[] account, int num_accts); This method prints a table of the complete account information for every active account.

EXTRA CREDIT #1: Use nested classes: 1. A BankAccount consists of a Depositor, an account number, an account type, and a balance. 2. A Depositor has a Name and a social security number. 3. A Name consists of first and last names.

EXTRA CREDIT #2: Use a constructor to initialize the data members of a new account (including the initial accounts of the database). Hint: a constructor is a method that can be called.

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

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

What if we set a cutoff score and no one passes?

Answered: 1 week ago

Question

=+ 2. Do you have a license and do you have insurance?

Answered: 1 week ago