Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

No extra credit Hemework-Topic 7-Bank Accounts: You have been hired as a programmer by a major bank. Your Erst project is a small banking transaction

image text in transcribed
image text in transcribed No extra credit
Hemework-Topic 7-Bank Accounts: You have been hired as a programmer by a major bank. Your Erst 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, and balance inquiries. Initially, the account information of existing customers is to be read into a pair of parallel arrays-one for account numbers, the other for balances. The bank can handle up to MAX NUM accounts. Use the following method to read in the data values public static int readkccts (int!1 acctnum, double balance, int max accts) This method fills up the account number and balance arrays (up to max accts) and returns the actual number of accounts read in (later referred to as num accts). After initialization, the main program prints the initial database of accounts and balances described below. Use method printAccts The peogram then allows the uscr to sclect from the following menu of transactions: Select one of the following: W-Withdrawal D - Deposit N - New account B Balance Q-Quit X- Delete Account-Extra Credit Use the following methed to produce the menu: public static void nenu This method only displays the menu. The main program then prompts the user for a selection. You should verify that the uscr has typed in a valid selection (otherwise print out an error message and repeat the prompt) Onoe the user has entered a selection, one of the following methods should be called to perform the specifie transaction. At the end, before the user quits, the program prints the final contents of the account and balance arrays public static int findcet (int[1 acetnum, int num accts, int account) This method returns the index of account in the aectnum array if the account exists, and -1 if it doesnt. It is called by all the remaining methods. public statie void withdrawal (intl acctnun, doublel balance, int num accta), 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 ansount of the withdrawal. If the account does not comtain sufficient funds, it prints an ernor message and does not perform the transaction pubic static void deposit (intll acctnun, doublel1 balance, int num accts) This method prompes 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 (int[] acctnun, double[] balance, int num accts); This method prompts the user for a new account number. If the account already exists, it prints an crror message. Otherwise, it adds the account to the acctnum array with an initial balance of O. It returns the new number of accounts public static void balance (intl acctnum, doublet] balance, 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 atatic void printAccts(intl acctnum, double balance, int num accta) prints all customer informationaccount number and balance

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions