Question Solved1 Answer Java 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, 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 readAcets(int] acctNum, double[] balance, int max.ccts) This method fills up the account number and balance arrays (up to maxAects) by reading from an input file until EOF is reached, and counting how many accounts are read in. It returns the actual number of accounts read in (later referred to as numAccts). After initialization, the main program prints the initial database of accounts and balances. Use method printAcets() 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 Q- Quit X - Delete Account - Extra Credit 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 final contents of the account and balance arrays. public static int findAcet (int) acetNum, int numAccts, int account); This method returns the index of account in the sectNum array if the account exists, and -1 if it doesn't. It is called by all the remaining methods. public static void withdrawal (int[] acctNum, double[] balance, int numAccts); This method returns the index of account in the acetNum array if the account exists, and -1 if it doesn't. It is called by all the remaining methods. public static void withdrawal (int[] acetNum, double[] balance, int numAccts); 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 pubic static void deposit(int[] acct.Num, double balance, 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 (int[] acetNum, double[balance, int numAccts); 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 acetNum array with an initial balance of O. It returns the new number of accounts. public static void balance (int[] acetNum, double balance, int numAccts): 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 printAcets (int[] acetNum, double[balance, int numacets); This method prints a 2-column table (with column headings) of all customer information--account numbers and balances.

ENBA19 The Asker · Computer Science
Java

Transcribed Image Text: 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, 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 readAcets(int] acctNum, double[] balance, int max.ccts) This method fills up the account number and balance arrays (up to maxAects) by reading from an input file until EOF is reached, and counting how many accounts are read in. It returns the actual number of accounts read in (later referred to as numAccts). After initialization, the main program prints the initial database of accounts and balances. Use method printAcets() 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 Q- Quit X - Delete Account - Extra Credit 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 final contents of the account and balance arrays. public static int findAcet (int) acetNum, int numAccts, int account); This method returns the index of account in the sectNum array if the account exists, and -1 if it doesn't. It is called by all the remaining methods. public static void withdrawal (int[] acctNum, double[] balance, int numAccts); This method returns the index of account in the acetNum array if the account exists, and -1 if it doesn't. It is called by all the remaining methods. public static void withdrawal (int[] acetNum, double[] balance, int numAccts); 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 pubic static void deposit(int[] acct.Num, double balance, 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 (int[] acetNum, double[balance, int numAccts); 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 acetNum array with an initial balance of O. It returns the new number of accounts. public static void balance (int[] acetNum, double balance, int numAccts): 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 printAcets (int[] acetNum, double[balance, int numacets); This method prints a 2-column table (with column headings) of all customer information--account numbers and balances.
More
Transcribed Image Text: 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, 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 readAcets(int] acctNum, double[] balance, int max.ccts) This method fills up the account number and balance arrays (up to maxAects) by reading from an input file until EOF is reached, and counting how many accounts are read in. It returns the actual number of accounts read in (later referred to as numAccts). After initialization, the main program prints the initial database of accounts and balances. Use method printAcets() 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 Q- Quit X - Delete Account - Extra Credit 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 final contents of the account and balance arrays. public static int findAcet (int) acetNum, int numAccts, int account); This method returns the index of account in the sectNum array if the account exists, and -1 if it doesn't. It is called by all the remaining methods. public static void withdrawal (int[] acctNum, double[] balance, int numAccts); This method returns the index of account in the acetNum array if the account exists, and -1 if it doesn't. It is called by all the remaining methods. public static void withdrawal (int[] acetNum, double[] balance, int numAccts); 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 pubic static void deposit(int[] acct.Num, double balance, 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 (int[] acetNum, double[balance, int numAccts); 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 acetNum array with an initial balance of O. It returns the new number of accounts. public static void balance (int[] acetNum, double balance, int numAccts): 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 printAcets (int[] acetNum, double[balance, int numacets); This method prints a 2-column table (with column headings) of all customer information--account numbers and balances.
See Answer
Add Answer +20 Points
Community Answer
LQ845E The First Answerer
See all the answers with 1 Unlock
Get 4 Free Unlocks by registration

**** Please Give me a thumbs up if you like my answer, I'm really in need of one :) **** Code: import java.lang.*; import java.util.Scanner; class Bank { public static void main(String args[]) { Scanner s = new Scanner(System.in); int MAX_NUM; char ch; System.out.println("Enter the Maximum number of accounts"); MAX_NUM = s.nextInt(); int[] acctNum = new int[MAX_NUM]; double[] balance = new double[MAX_NUM]; int numAccts = readAccts(acctNum, balance, MAX_NUM); printAccts(acctNum, balance, numAccts); do { menu(); System.out.println("Enter your choice"); ch = s.next().charAt(0); switch (ch) { case 'W': withDrawal(acctNum, balance, numAccts); break; case 'D': deposit(acctNum, balance, numAccts); break; case 'N': numAccts = newAccount(acctNum, balance, numAccts); break; case 'B': balance(acctNum, balance, numAccts); break; case 'P': printAccts(acctNum, balance, numAccts); break; case 'Q': System.exit(0); default: System.out.println("Invalid Choice"); } } while (ch != 'Q'); } // Read Accounts public static int readAccts(int[] acctNum, double[] balance, int maxAccts) { Scanner s = new Scanner(System.in); System.out.println("Enter how many accounts you want to read"); int numAccts = s.nextInt(); for (int i = 0; i < numAccts; i++) { System.out.println("Enter Account number and initial balance"); acctNum[i] = s.nextInt(); balance[i] = s.nextDouble(); } return numAccts; } // method for print account details public static void printAccts(int[] acctNum, double[] balance, int numAccts) { System.out.println("AccNottBalance"); for (int i = 0; i < numAccts; i++) { System.out.println(acctNum[i] + "tt" + balance[i]); } } // method for print menu details public static void menu() { System.out.println("W-withdrawnD-DepositnN-New accountnB-balancenP-printnQ-Quitnn"); } // method for withdraw public static void withDrawal(int[] acctNum, double[] balance, int numAccts) { int flag = 0; Scanner s = new Scanner(System.in); System.out.println("Enter Account Number"); int acnum = s.nextInt(); for (int i = 0; i < numAccts; i++) { if (acctNum[i] == acnum) { flag = 1; System.out.println("Enter amount to withdraw"); double withdraw = s.nextDouble(); if (balance[i] < withdraw) { System.out.println("Insufficient balance"); break; } else { balance[i] = balance[i] - withdraw; System.out.println("Withdraw successful"); System.out.println("Current Balanc ... See the full answer