Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

file name: Assignment4_TransferInfo(txt) TR11 12345 67890 200.0 TR12 54321 24680 1000.0 TR16 43210 56789 20.0 TR20 11111 98765 2.0 file name: Assignment4_AccountInfo(txt) 12345 John Doe

image text in transcribedimage text in transcribedimage text in transcribed

file name: Assignment4_TransferInfo(txt)

TR11 12345 67890 200.0 TR12 54321 24680 1000.0 TR16 43210 56789 20.0 TR20 11111 98765 2.0

file name: Assignment4_AccountInfo(txt)

12345 John Doe 2000.0 67890 Can Do 1500.0 24680 Jane Doe 1000.0 54321 Ceyn Do 500.0 43210 Mert Bayrak 150.0 98765 Matt Byerock 15.0

file name: Assignment4_AccountInfoOut(txt)

12345 John Doe 1800.0 67890 Can Do 1700.0 24680 Jane Doe 1000.0 54321 Ceyn Do 500.0 43210 Mert Bayrak 150.0 98765 Matt Byerock 15.0

file name: Assignment4(log)

Transfer TR11 resulted in code 0: STX - Transfer Successful Transfer TR12 resulted in code 3: NSF - Insufficient Funds Transfer TR16 resulted in code 1: TNF - To Account not found Transfer TR20 resulted in code 2: FNF - From Account not found

(dont use System.exit() in your code.)

i'm expected to see answers of 1,2,3,4,5,6 methods not 7,8,9. (JAVA)

Requirements: Write a program that will perform the following tasks: 1. Get accounts information a. This will involve reading a file of account information from a file. 2. Make transfers between accounts a. A series of transfers will be requested (also through a file) 3. Create output file of accounts a. After all transfers are completed, write to an output file the new account information in the same format as the source file 4. Create a log file a. A log should note the requested transfer and whether it was successful To facilitate the execution of this program, you will add and modify (at minimum) the following methods: 1. countAccounts(filename) a. A method to determine how many accounts are in a file using a filename b. Takes a String as a parameter representing the filename C. Displays nothing d. Returns an integer that represents the number of accounts in the file (Protip: this will be the number of lines in the file) 2. readAccountInfo(acctNums, names, surnames, balances, filename) a. A method to read the contents of the file into the various necessary arrays b. It will take five parameters i. Integer array for account numbers ii. String array for account owner names iii. String array for account owner surnames iv. Decimal array for account balances v. String for the filename vi. Each array passed should be the size of the number of accounts in the file CSE 101 Fall 2021 1 CSE 101 Programming Assignment 4 Page 2 of 5 c. It will read the file to get the information and place it into the arrays i. The file format will be one account per line ii. Each line will consist of an account number, space, Name (no spaces), space, Surname (no spaces), space, the current balance iii. Example below: d. Protip: you can use the return value from the countAccounts() method to set the size of the arrays before calling this method e. Returns None 3. deposit(balances, index, amount) a. A method to make a deposit to the balances array at the given index b. Returns True if the deposit is successful, false otherwise c. If the deposit amount is valid, the balances array value at the index given should be increased by the amount passed d. If the deposit amount is not valid, the array should not be changed e. Note: this is not the same as the isDepositValid() method, but can make use of that method 4. withdrawal balances, index, amount) a. A method to make a withdrawal from the balances array at the index b. Returns True if the withdrawal is successful, false otherwise cIf the withdrawal amount is valid, the balances array value at the index given should be decreased by the amount passed d. If the withdrawal amount is not valid, the array should not be changed e. Note: this is not the same as the isWithdrawalvalid() method, but can make use of that method 5. transfer(acctNums, balances, acctNumFrom, acctNumTo, amount) a. A method to make a transfer from one account to another b. Will update the balances array passed by removing funds from the acctNumFrom account and adding the funds to the acctNumTo account c Returns an integer with a code to indicate if a transfer was successful i. O for successful transfer ii. 1 if the acctNumTo was not found in the acctums array iii. 2 if the acctNumFrom was not found in the acctNums array iv. 3 if the amount cannot be withdrawn from the from account d. If the transfer cannot be completed (i.e. does not return a code of o), none of the balances should be changed 6. writeAccountInfo(acctNums, names, surnames, balances, filename) a. A method to write the contents of the arrays to an output file b. It will take five parameters i. Same as readAccountInfo() c. It will write a new file using the information contained in the arrays with the same format as the source file for readAccountInfo() d. Returns None 7. findAcct(acctNums, acctNum) a. No change from previous assignment CSE 101|Fall 2021 2 CSE 101 Programming Assignment 4 Page 3 of 5 8. isDepositValid(amount) a. No change from previous assignment 9. isWithdrawalvalid(balance, amount) a. No change from previous assignment 10. Any other methods you feel helpful can be implemented, however, these will be the only methods tested. Design: To execute this program, the main method will be used by passing the base filename as a command line argument. \Assignment4>java ATM_123456789 Assignment4 Assignment4> The account information will be contained in a file called {basefilename}_AccountInfo.txt It will have the format described above. Example shown: Assignment4_AccountInfo.txt - Notepad File Edit Format View Help |12345 John Doe 2000.0 67890 Can Do 1500.0 24680 Jane Doe 1000.0 54321 Ceyn Do 500.0 43210 Mert Bayrak 150.0 98765 Matt Byerock 15.0 In 1, Col 1 100% Windows (CRLF) UTF-8 0 X The transfer information will be contained in a file called {basefilename}_Transferinfo.txt It will have the format of transfer number (String), space, acctNumFrom, space, acctNumTo, space, amount. Example shown: Assignment4_Transferinfo.txt - Notepad File Edit Format View Help TR11 12345 67890 200.0 TR12 54321 24680 1000.0 TR16 43210 56789 20.0 TR20 11111 98765 2.0 In 1, Col 1 100% Windows (CRLF) UTF-8 The output account information will be written to a file called {basefilename}_AccountInfoOut.txt It will have the same format as the source account information. Assignment4_AccountInfoOut.txt - Notepad File Edit Format View Help 12345 John Doe 1800.0 67890 Can Do 1700.0 24680 Jane Doe 1000.0 54321 Ceyn Do 500.0 43210 Mert Bayrak 150.0 98765 Matt Byerock 15.0 Ln 1, Col 1 100% Windows (CRLF) UTF-8 The log file will be written to a file called {basefilename}.log It will have the format of Transfer ", transfer number, "resulted in code", result code,:", description. | Assignment4.log - Notepad File Edit Format View Help Transfer TR11 resulted in code 0: STX - Transfer Successful Transfer TR12 resulted in code 3: NSF - Insufficient Funds Transfer TR16 resulted in code 1: TNF - To Account not found Transfer TR20 resulted in code 2: ENF - From Account not found - - Ln 1, Col 1 100% Windows (CRLF) UTF-8

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

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions

Question

3. Keep a list of suggestions.

Answered: 1 week ago