Question Solved1 Answer I need(1. The Java source code file (e.g., HW7_1.java) 2. The initial database of accounts file (initAccts.txt) 3. The test cases input file (e.g., testCases.txt) 4. The program generated output file (e.g., output.txt) 1. All output must be file directed (you must add additional parameters to the methods as needed) 2. Only output must go to the file - not interactive prompts or menus (which go to the monitor). 3. No global variables are allowed 4. The program and all methods must be properly commented. 5. The program must be properly tested. a. The initial database should consist of at least 7 accounts b. The initial database should be printed to the file c. Test at least 2 invalid menu selections d. Test at least 2 balance inquiries: i. valid account ii. invalid account e. Test at least 3 deposits: i. valid account - valid deposit amount ii. valid account - invalid deposit amount iii. invalid account f. Test at least 4 withdrawals: i. valid account - valid withdrawal amount ii. valid account - invalid withdrawal amount iii. valid account - insufficient funds iv. invalid account g. Create at least 3 new accounts with an initial balance of 0.0 h, Test the creation of at least 1 invalid new account i. Test several transactions on the new accounts (deposits, withdrawals, etc.) 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 readAccts(int[] acctNum, double[] balance, int maxAccts) This method fills up the account number and balance arrays (up to maxAcets) 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 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 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 findAcct (int[] acetNum, int numAccts, int account); This method returns the index of account in the acctNum 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[] acctNum, 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[] acctNum, 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 acctNum 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 printAccts (int[] acetNum, double[] balance, int numAccts); This method prints a 2-column table (with column headings) of all customer information--account numbers and balances. Sample Output: Transaction Type: Deposit Account Number: 9876 Current Balance: $300.50 Amount to Deposit: $123.45 New Balance: $423.95 Transaction Type: Withdrawal Account Number: 9876 Current Balance: $423.95 Amount to withdraw: $765.43 Error: Insufficient Funds Available

GXOPNV The Asker · Computer Science

I need(1. The Java source code file (e.g., HW7_1.java) 2. The initial database of accounts file (initAccts.txt) 3. The test cases input file (e.g., testCases.txt) 4. The program generated output file (e.g., output.txt)

1. All output must be file directed (you must add additional parameters to the methods as needed) 2. Only output must go to the file - not interactive prompts or menus (which go to the monitor). 3. No global variables are allowed 4. The program and all methods must be properly commented. 5. The program must be properly tested. a. The initial database should consist of at least 7 accounts b. The initial database should be printed to the file c. Test at least 2 invalid menu selections d. Test at least 2 balance inquiries: i. valid account ii. invalid account e. Test at least 3 deposits: i. valid account - valid deposit amount ii. valid account - invalid deposit amount iii. invalid account f. Test at least 4 withdrawals: i. valid account - valid withdrawal amount ii. valid account - invalid withdrawal amount iii. valid account - insufficient funds iv. invalid account g. Create at least 3 new accounts with an initial balance of 0.0 h, Test the creation of at least 1 invalid new account i. Test several transactions on the new accounts (deposits, withdrawals, etc.)

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 readAccts(int[] acctNum, double[] balance, int maxAccts) This method fills up the account number and balance arrays (up to maxAcets) 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 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 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 findAcct (int[] acetNum, int numAccts, int account); This method returns the index of account in the acctNum 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[] acctNum, 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[] acctNum, 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 acctNum 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 printAccts (int[] acetNum, double[] balance, int numAccts); This method prints a 2-column table (with column headings) of all customer information--account numbers and balances. Sample Output: Transaction Type: Deposit Account Number: 9876 Current Balance: $300.50 Amount to Deposit: $123.45 New Balance: $423.95 Transaction Type: Withdrawal Account Number: 9876 Current Balance: $423.95 Amount to withdraw: $765.43 Error: Insufficient Funds Available
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 readAccts(int[] acctNum, double[] balance, int maxAccts) This method fills up the account number and balance arrays (up to maxAcets) 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 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 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 findAcct (int[] acetNum, int numAccts, int account); This method returns the index of account in the acctNum 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[] acctNum, 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[] acctNum, 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 acctNum 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 printAccts (int[] acetNum, double[] balance, int numAccts); This method prints a 2-column table (with column headings) of all customer information--account numbers and balances. Sample Output: Transaction Type: Deposit Account Number: 9876 Current Balance: $300.50 Amount to Deposit: $123.45 New Balance: $423.95 Transaction Type: Withdrawal Account Number: 9876 Current Balance: $423.95 Amount to withdraw: $765.43 Error: Insufficient Funds Available
See Answer
Add Answer +20 Points
Community Answer
CR9GDR
See all the answers with 1 Unlock
Get 4 Free Unlocks by registration

General GuidanceThe answer provided below has been developed in a clear step by step manner.Step: 1.lcWjel{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;font-size:0.75rem;box-sizing:border-box;}/*!sc*/ data-styled.g366[id="sc-mwpquf-0"]{content:"lcWjel,"}/*!sc*/ .loOCZZ{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;}/*!sc*/ .loOCZZ .align-left{text-align:left;}/*!sc*/ .loOCZZ .align-center{text-align:center;}/*!sc*/ .loOCZZ .align-right{text-align:right;}/*!sc*/ data-styled.g367[id="sc-mwpquf-1"]{content:"loOCZZ,"}/*!sc*/ .cpESDm .DraftEditor-editorContainer,.cpESDm .DraftEditor-root,.cpESDm .public-DraftEditor-content{height:inherit;text-align:initial;}/*!sc*/ .cpESDm .public-DraftEditor-content[contenteditable='true']{-webkit-user-modify:read-write-plaintext-only;}/*!sc*/ .cpESDm .DraftEditor-root{position:relative;}/*!sc*/ .cpESDm .DraftEditor-editorContainer{background-color:rgba(255,255,255,0);border-left:0.1px solid transparent;position:relative;z-index:1;}/*!sc*/ .cpESDm .public-DraftEditor-block{position:relative;}/*!sc*/ .cpESDm .DraftEditor-alignLeft .public-DraftStyleDefault-block{text-align:left;}/*!sc*/ .cpESDm .DraftEditor-alignLeft .public-DraftEditorPlaceholder-root{left:0;text-align:left;}/*!sc*/ .cpESDm .DraftEditor-alignCenter .public-DraftStyleDefault-block{text-align:center;}/*!sc*/ .cpESDm .DraftEditor-alignCenter .public-DraftEditorPlaceholder-root{margin:0 auto;text-align:center;width:100%;}/*!sc*/ .cpESDm .DraftEditor-alignRight .public-DraftStyleDefault-block{text-align:right;}/*!sc*/ .cpESDm .DraftEditor-alignRight .public-DraftEditorPlaceholder-root{right:0;text-align:right;}/*!sc*/ .cpESDm .public-DraftEditorPlaceholder-root{color:#9197a3;position:absolute;width:100%;z-index:1;}/*!sc*/ .cpESDm .public-DraftEditorPlaceholder-hasFocus{color:#bdc1c9;}/*!sc*/ .cpESDm .DraftEditorPlaceholder-hidden{display:none;}/*!sc*/ .cpESDm .public-DraftStyleDefault-block{position:relative;white-space:pre-wrap;}/*!sc*/ .cpESDm .public-DraftStyleDefault-ltr{direction:ltr;text-align:left;}/*!sc*/ .cpESDm .public-DraftStyleDefault-rtl{direction:rtl;text-align:right;}/*!sc*/ .cpESDm .public-DraftStyleDefault-listLTR{direction:ltr;}/*!sc*/ .cpESDm .public-DraftStyleDefault-listRTL{direction:rtl;}/*!sc*/ .cpESDm .public-DraftStyleDefault-ol,.cpESDm .public-DraftStyleDefault-ul{margin:16px 0;padding:0;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth0.public-DraftStyleDefault-listLTR{margin-left:1.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth0.public-DraftStyleDefault-listRTL{margin-right:1.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth1.public-DraftStyleDefault-listLTR{margin-left:3em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth1.public-DraftStyleDefault-listRTL{margin-right:3em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth2.public-DraftStyleDefault-listLTR{margin-left:4.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth2.public-DraftStyleDefault-listRTL{margin-right:4.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth3.public-DraftStyleDefault-listLTR{margin-left:6em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth3.public-DraftStyleDefault-listRTL{margin-right:6em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth4.public-DraftStyleDefault-listLTR{margin-left:7.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth4.public-DraftStyleDefault-listRTL{margin-right:7.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-unorderedListItem{list-style-type:square;position:relative;}/*!sc*/ .cpESDm .public-DraftStyleDefault-unorderedListItem.public-DraftStyleDefault-depth0{list-style-type:disc;}/*!sc*/ .cpESDm .public-DraftStyleDefault-unorderedListItem.public-DraftStyleDefault-depth1{list-style-type:circle;}/*!sc*/ .cpESDm .public-DraftStyleDefault-orderedListItem{list-style-type:none;position:relative;}/*!sc*/ .cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-listLTR:before{left:-36px;position:absolute;text-align:right;width:30px;}/*!sc*/ .cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-listRTL:before{position:absolute;right:-36px;text-align:left;width:30px;}/*!sc*/ .cpESDm .public-DraftStyleDefault-orderedListItem:before{content:counter(ol0) '. ';counter-increment:ol0;}/*!sc*/ .cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth1:before{content:counter(ol1,lower-alpha) '. ';counter-increment:ol1;}/*!sc*/ .cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth2:before{content:counter(ol2,lower-roman) '. ';counter-increment:ol2;}/*!sc*/ .cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth3:before{content:counter(ol3) '. ';counter-increment:ol3;}/*!sc*/ .cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth4:before{content:counter(ol4,lower-alpha) '. ';counter-increment:ol4;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth0.public-DraftStyleDefault-reset{counter-reset:ol0;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth1.public-DraftStyleDefault-reset{counter-reset:ol1;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth2.public-DraftStyleDefault-reset{counter-reset:ol2;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth3.public-DraftStyleDefault-reset{counter-reset:ol3;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth4.public-DraftStyleDefault-reset{counter-reset:ol4;}/*!sc*/ .cpESDm .public-DraftStyleDefault-ltr{text-align:inherit;}/*!sc*/ .cpESDm .public-DraftStyleDefault-rtl{text-align:inherit;}/*!sc*/ data-styled.g370[id="sc-mwpquf-4"]{content:"cpESDm,"}/*!sc*/ .jhimFq{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;box-sizing:border-box;border:2px solid transparent;}/*!sc*/ .jhimFq h2{font-size:16px;}/*!sc*/ .jhimFq h3{font-size:14px;}/*!sc*/ data-styled.g371[id="sc-mo29cs-0"]{content:"jhimFq,"}/*!sc*/ .iQAUeM{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:16px;}/*!sc*/ data-styled.g582[id="sc-z3f5s1-0"]{content:"iQAUeM,"}/*!sc*/ .bVFlsN{margin:0;}/*!sc*/ data-styled.g587[id="sc-1swtczx-0"]{content:"bVFlsN,"}/*!sc*/ .gpAhdE{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;line-height:normal;}/*!sc*/ data-styled.g602[id="sc-1sugbjn-0"]{content:"gpAhdE,"}/*!sc*/ Code:Appointment.javapublic class Appointment {// data membersString type;int patientID;String patientName;String appointmentDateTime;String doctorName;String details;public Appointment(String type, int patientID, String patientName, String appointmentDateTime, String doctorName,String details) {this.type = type;this.patientID = patientID;this.patientName = patientName;this.appointmentDateTime = appointmentDateTime;this.doctorName = doctorName;this.details = details;}// getter methodspublic String getType() {return type;}public int getPatientID() {return patientID;}public String getPatientName() {return patientName;}public String getAppointmentDateTime() {return appointmentDateTime;}public String getDoctorName() {return doctorName;}public String getDetails() {return details;}// setter methodspublic void setType(String type) {this.type = type;}public void setPatientID(int patientID) {this.patientID = patientID;}public void setPatientName(String patientName) {this.patientName = patientName;}public void setAppointmentDateTime(String appointmentDateTime) {this.appointmentDateTime =appointmentDateTime;}public void setDoctorName(String doctorName) {this.doctorName = doctorName;}public void setDetails(String details) {this.details = details;}}SQUStudentsClinic.javaimport java.io.BufferedWriter;import java.io.File;import java.io.FileNotFoundException;import java.io.FileWriter;import java.io.IOException;import java.util.ArrayList;import java.util.Scanner;import java.util.StringTokenizer;//class definitionpublic class SQUStudentsClinic {// variablestatic Scanner inp;static ArrayList<Appointment> schedule;// showing the menu option to resceptioniststatic void menu() {// printing the menu options availableSystem.out.println("Which service do you want?");System.out.println("tPress "1" to schedule an appointment");System.out.println("tPress "2" to check appointment");System.out.println("tPress "3" to cancel an appointment");System.out.println("tPress "4" to reschedule an appointment");System.out.println("tPress "#" to exit");}// driver methodpublic static void main(String[] args) throws FileNotFoundException, IOException {// variableschar choice;// creating object to read the clinic appointment dataScanner file = new Scanner(new File("Clinic Appointments.txt"));// arrayList to store the appointment informationschedule = new ArrayList();StringTokenizer stk;// showing the input file contentwhile (file.hasNext()) {stk = new StringTokenizer(file.nextLine(), "|");while (stk.hasMoreTokens()) {if (stk.nextToken().trim().equalsIgnoreCase("Emergency")) {schedule.add(new Appointment("Emergency", Integer.parseInt(stk.nextToken().trim()),stk.nextToken().trim(), stk.nextToken().trim(), stk.nextToken().trim(),stk.nextToken().trim()));} else {schedule.add(new Appointment("Routine", Integer.parseInt(stk.nextToken().trim()), stk.nextToken().trim(),stk.nextToken().trim(), stk.nextToken().trim(), stk.nextToken().trim()));}}}// creating object for taking user inputinp = new Scanner(System.in);// clinic message headerSystem.out.println("*** Welcome to SQU student's clinic ***");// loop until user wish to exitdo {// calling method to show menumenu();// storing the user choicechoice = inp.next().charAt(0);inp.nextLine();// using switch to decide the user operationswitch (choice) {case '1':schedule_appointment();break;case '2':check_appointment();break;case '3':cancel_appointment();break;case '4':reschedule_appointment();break;case ' ... See the full answer