A bank maintains its account records in a sequential text fi
A bank maintains its account records in a sequential text file named accounts.txt. The record for each account contains the following: account number, account holder’s name, street address, city, state, zip, account type, and current balance. Design the logic, in pseudocode( basic such as input/output while/endwhile), for a program, that
a. Reads each record in the accounts.txt file
b. Calculates interest for the account based on the following rules: i. If the account type is “checking” and the current balance is at least $1,000, the interest rate is 1%, otherwise, it is 0.5% ii. If the account type is “savings” the interest rate is 2%
c. Calculates the balance after adding interest
d. Writes the account data with the updated account balance to another file named processed_accounts.txt
e. In another file named statements.txt, writes the account data in the proper format for a bank statement that has i. the account holder’s name and address as required by the post office ii. the account number iii. the balance before interest was added iv. the interest amount in dollars v. the balance after adding interest
So far I only have the declerations..
inputFile accountsFile
outputFile processed_accountsFile
outputFile statementsFile
num acctNumber
string acctHolderName
string streetAddress
string city
string state
num zip
num paymentDue
num daysLate
num dueWithLateFee
Solution
num acctNumber
 string acctHolderName
 string streetAddress
 string city
 string state
 num zip
 string acType
 num balance
 num rate
 num interest
 num newBalance
Open file1 accounts.txt
 Open file2 processed_accounts.txt in write mode
 Open file3 statements.txt in write mode
for each line in file do
    acctNumber= f1.readNextNmber
    acctHolderName= f1.readNextString
    streetAddress = f1.readNextString
    city = f1.readNextString
    state = f1.readNextString
    zip = f1.readNextNmber
    acType= f1.readNextString
    balance = f1.readNextNmber
   
    // Calculate interest
    if acType == \"checking\" then
        if balance <= 1000 then rate = 0.01
        else rate = 0.005
    else if acType== \"savings\" then rate = 0.02
   interest = balance* rate
    newBalance = balance + interest
   
    write new line to file2 as
   
    f2.writeNumber(acctNumber)
    f2.writeString(acctHolderName)
    f2.writeString(streetAddress)
    f2.writeString(city)
    f2.writeString(state)
    f2.writeNumber(zip)
    f2.writeString(acType)
    f2.writeNumber(newBalance)
    f2.writeString(\"\ \") // adding new line
// write details to statements file
  
    f3.writeString(acctHolderName)
    f3.writeString(streetAddress)
    f3.writeString(city)
    f3.writeString(state)
    f3.writeNumber(zip)
    f3.writeNumber(acctNumber)
    f3.writeNumber(balance)
    f3.writeNumber(interest)
    f3.writeNumber(newBalance)
end forloop
 close f1
 close f2
 close f3  


