The ATM Transaction Validator requires a loop and if-then logic. You will write the output to a file called statement.txt and read in a file called transactions.txt which contains the following information on each line of the file:
customer last name (two words followed by a comma as a delimiter)
checking account balance
transaction type code
transaction amount
Provide an appropriate error message if the file cannot be found. (2 points)
Remember to echo (display) each input item as well. (5 points)
A negative amount should cause an error message to be written and the transaction is ignored. (5 points)
Invalid transaction types must be reported as errors. (5 points)
All monetary values should be printed with 2 decimal places and a dollar sign using the currency format. (5 points)
You should also show the balance before and after, even if the transaction is bad or ignored. (5 points)
Transaction type codes are (W)ithdraw, (D)eposit, (R)eport the balance
W
Subtract this money from the account.
Allowed only if amount is positive and (less than or equal) to the balance or an error message is printed.
D
Add this money to the account. Only positive amount is allowed.
R
Report the current balance (amount is ignored).
At the end of the transaction the program writes out the new balance or why it couldn't be done.
In any case, if the ending balance is below $300, a warning message should be printed. (5 points)
You need to create the input data file and use the following exact data to test your program:
Joe Turing, 4124.50 D 200
Charles Babbage, 300.00 D 100
Sam Backus, 350.25 W 51
Sam Hopper, 600.50 X 600
Robert McCarthy, 1000.00 R 0
Jack Atanasoff, 200.00 W 200
Anne Stroustrup, 300.75 W 301
Amanda Hollerith, 500.00 W -2
For example, the input file below:
Stacy Jones, 300 D 100
Michael White, 350 W 51
might produce output as shown below:
Customer Name: Jones, Stacy
Checking balance before transaction $ 300.00
Transaction Type: D
Transaction amount $100.00
Checking balance after transaction $ 400.00
----------------------------------------------
Customer Name: White, Michael
Checking balance before transaction $ 350.00
Transaction Type: W
Transaction amount $51.00
Checking balance after transaction $ 299.00
Warning: account is below minimum $ 300.00
What to turn in:
Your program listing
Hardcopy of Output file statement.txt from the program
Hardcopy of Input file transactions.txt