Hi everyone. I've been working on my project about bank account transactions (withdraw, deposit, check cashed, and balance inquiry) using "account.txt". My TA said that I have to use temporary file. This temporary file will read line by line to find what the user is looking for. However, I did not understand this temporary OPEN file at all. Does anyone explain what that is, and if it's possible, would you attach example of it?
Here are the project instructions: This project is about writing a program to perform transactions on bank accounts. You will be given a file which contains all the accounts in the bank (the file is named “account.txt”). Your program is to provide an interactive menu for users to perform transactions on these accounts. Your program needs to update the account file after each transaction. The user may perform transactions on accounts that are not available. Your program needs print an error message on the screen and return to the menu. In addition, your program needs to print whether a transaction is successful. For unsuccessful transaction, your program will print out the reason for the failed transaction.
Your program needs to be able to handle the following transactions:
- Deposit money into an account
- Withdraw money from an account
- Check cashed against an account
- Balance inquiry of an account
There is a limit on how many checks can be cashed against a saving account. The limit is 2 checks per month. There is a $0.25 penalty for each check cashed over the limit. If there is enough fund to cash the check but not the penalty, the transaction should go through and the resulting balance would be zero.
Here is the format in the account file for one account (data fields are separated by exactly one space): Account type, S for saving, C for checking (1 character) Account number of 5 digits Last name of account holder (15 characters) First name of account holder (15 characters) Balance of the account in the form xxxxx.xxx An integer field indicating how many checks have been cahsed this month (three digit) An interest rate in the form of xx.xx (e.g. 10.01 = 10.01%) For names with fewer than 15 characters, the data will be padded to have width of 15 characters.
Here is an example of the account file: C 12345 Smith John 100.000 10 0.00 S 45834 Doe Jane 3462.340 0 0.30 C 58978 Bond Jones 13.320 5 0.00
*Creating temporary file There is a way in FORTRAN to create a temporary file. Use: OPEN(UNIT = , STATUS = "SCRATCH", ...) There is no need to provide (FILE = ””). By using a temporary file, you can copy the accounts from the account file to the temporary file. Then when you copy the data back from the temporary file to the account file, perform the necessary transactions. Your program should not copy accounts between these two files if a transaction is to be failed.
Please forgive my english, I'm Japanese.
Yuuka