1 CS 215 – Fall 2020 Project 2 Version 0 – coding specifications incomplete Learning Objectives: - Use of a Partial Array of Structures to store data. - Writing functions from a detailed design...

There's a little more part left but i just want you to start working on it so there's more time later.


1 CS 215 – Fall 2020 Project 2 Version 0 – coding specifications incomplete Learning Objectives: - Use of a Partial Array of Structures to store data. - Writing functions from a detailed design document - Reading data from files and writing data to files - More problem solving with variables, decisions and loops General Description: You are to implement an Automatic Teller Machine (ATM) for a small bank. Each day, the machine is started up by the bank’s IT support. At this time, the ATM reads a list of current accounts from a text file and starts normal operation. Once started, customers use the ATM to make deposits, withdrawals and balance inquiries. For each customer, the ATM asks for and validates the account number and PIN number, then performs the deposit/withdrawal/balance-inquiry for the customer. IT support may enter a secret account number and PIN (“admin” and 9999) to conduct maintenance on account data. Maintenance includes adding a new account, removing an account, printing an accounts or transactions report, sorting the account data by name or account number, and shutting the ATM down. For each transaction completed by a customer or IT support person, a transaction record is created. The ATM has a limited number of transactions that may be done in one active session. Once this limit is reached, no more transactions may be done until the ATM is shutdown and restarted. Transactions and updated Accounts are written to a data file when the shutdown occurs. An Account consists of the following data fields: (the program does not have to enforce widths, data types, or assumptions when data is entered; widths are specified for using setw()) - Account Number: any digits or characters, assumed to have no spaces (field width = 10) - Account Name: customer name which may contain spaces (field width = 30) - PIN: a 4-digit number, but no math is performed on it, so implement as a string (field width = 4) - Balance: a dollar amount that does not exceed $99,999.99 (field width 8 ) For ease of testing, there will be a maximum of five (5) accounts the ATM can handle. You may temporarily change this number while working on the project. A Transaction consists of the following data fields: - A 1 character Transaction Code: W withdrawal by the customer N new account added by admin D deposit by the customer R old account removed by admin I balance inquiry by the customer - Account Number: same as the Account Number on an Account - Transaction Amount: a dollar amount (field width = 8) - Balance: after transaction applied; same assumptions/width as Account Balance. For ease of testing, there will be a maximum of seven (7) transactions the ATM can handle. You may temporarily change this number while working on the project. 2 Detailed Description: a copy of an executable is available on the website. Start Up: The logo is displayed containing your name (not Ada Byron). You may also change the company name and “re-decorate” if you wish. The input data file “acctsIn.txt” is then read (see the file format in the specifications below). When the input file fails to open (you can test this by temporarily renaming the file), the program prints a failure message and the program ends. Note no writing of output files is done in this situation, but the ATM shutdown message is displayed. When the input data is read correctly, the program prints a data read message and proceeds to print the logo and the customer menu for the first customer. Main Operation: this process is repeated until the administrator shuts down the ATM - The logo is printed. - The user is asked to enter the Account Number and PIN. - One of the following then occurs (should be checked in this order): o When the admin account number and pin are entered, the Maintenance Menu (see below) is started. This process may result in the shutdown process being initiated. o When the number of transactions is maxed out, an unavailable message is printed. o When the account number and PIN entered are found in the Accounts list, the Customer Transaction Menu (see below) is started. o When none of the above occurs, an invalid account number/pin message is printed. The ATM shutdown message is printed when the above menu ends, just before the program ends. 3 Transaction (Customer) Menu Operation: Unlike most menus, this one will not repeat until an “exit” option is chosen. The Transaction Menu options are displayed as shown in the example. The program asks the user to choose an option (1-4). The user’s option is validated, forcing a correct answer to be entered. [It is assumed all input will be integers]. Once a correct answer is entered, one of the following actions is chosen: - Deposit: The current balance is displayed, and the user is asked to enter a deposit amount. The amount should be validated to be between 0 and (99999.99 – current balance: so the deposit will not allow the new balance to exceed 99,999.99). Once a valid amount is entered, the account balance is updated (increased), a transaction is (invisibly) logged [added to the transaction list], and the updated balance displayed as shown in the example. - Withdrawal: The current balance is displayed, and the user is asked to enter a withdrawal amount. The amount should be validated so that it is between 0 and the current balance on the account. Once a valid amount is entered, the account balance is updated (decreased), a transaction is logged, and the updated balance displayed as shown in the example. - Balance Inquiry: The current balance is displayed, and a transaction (with transaction amount 0) is logged. - Cancel Transaction: a message is displayed and no transaction is logged. After the completion of one of the four options, control is returned to the main operation loop, where the logo is displayed and the account number for the next customer is prompted. Maintenance Menu Operation: Like most menus, this one will repeat the operation until the exit option (4) is chosen. The user input is assumed to be integer, but the input should be validated to be between 1 and 8. Once a valid option is chosen, one of the following 8 operations will occur, and the menu will be repeated. 4 Add new account: First the program ensures the maximum number of accounts and maximum number of transactions have not been reached. If one has reached maximum, the appropriate message is printed and the operation does not continue. When there is room for a new account the program asks the user to enter the account number, name, PIN and balance. This data is stored as a new account in the account list, and a transaction is logged with the entered amount as both the transaction and new balance amounts. The account added message is displayed as shown. Remove account: A check for “account list full” is not needed, but a check for transaction list full is needed as described above for Add New Account. When there is room for another transaction, the program asks the user to enter the account number of the account to remove. The account list is searched, and if no account has the entered account number, a not found message is printed as shown. When the entered account number is found, the account is removed from the account list and a transaction is logged with transaction amount of 0. A removed message is then printed. Shut down ATM The Maintenance Menu simply returns a signal and exits the menu. The Main Operation catches the shutdown signal and does the following: - writes the current transaction data to a file (see specs below). - writes the current account data to a file (see specs below). - exits the main operation loop. - prints the shutdown message. - the program ends. Exit maintenance This simply exits the Maintenance Menu and returns control to the Main Operation loop, where it repeats to process the next customer. 5 Print current accounts: Prints a report of all current accounts in the format shown in the example. The field widths on the items are: Account Number: 12 PIN: 4 Balance: 9 Name: 30 The number of accounts is printed at the bottom of the report. There is a blank line before and after the report. Print current transactions: Prints a report of all current transactions in the format shown in the example. The field widths on the items are: Account Number: 12 Trans amount: 9 Trans (Code): 1 Balance: 9 The number of transactions is printed at the bottom of the report. There is a blank line before and after the report. Sort accounts by account number: Simply sorts the account list by account number in ascending (lowest to highest) order. Only a message is printed as shown. The results can be tested by the user by selecting Print current accounts on the next iteration of the menu. Sort accounts by Name: Simply sorts the account list by name in ascending (lowest to highest) order. Only a message is printed as shown. The results can be tested by the user by selecting Print current accounts on the next iteration of the menu. Coding Specifications: In general: Style: - use meaningful identifier names; data usually has “noun” names and functions have “verbs”. - use good indentation and some standard of style on all
Sep 27, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here