Problem 7. Design an algorithm that will produce a savings account balance report from a customer savings account file. Each input savings account record contains the account number, balance forward, deposits (sum of all deposits) , withdrawals (sum of all withdrawals), and interest earned. Your program is to read the savings account file and print a detail line for each savings account record showing account number, balance forward, deposits, withdrawals, interest earned and final account balance. The final account balance is calculated as balance forward + deposits – withdrawals + interest. A heading is to appear at the top of each page and allowance is to be made for 45 detail lines per page. At the end of the report, print the total balances forward, total deposits, total withdrawals, total interest earned and total final account balances. 7C. Solution algorithm

MAINLINE
Process_savings_account_record
Perform_initial_processing
Read savings_account_record
Get final_account_balance
Set line count,total deposits, total withdrawals, total interest earned, to zero
Set
DOWHILE NOT EOF
Calculate_final_account_balance
Print detail_line
Print savings_account_report
Read savings_account_record
Get final_account_balance
ENDDO
Print 'Final account balance = ', final_account_balance
Print 'Total balances forward = ‘, total_balance_forward
Print ‘Total deposits = ‘, total_deposits
Print ‘Total withdrawals = ‘, total_withdrawals
Print ‘Total interest earned = ‘, total_interest_earned
Print ‘Total final account balances =’, total_final_account_balances
END
end of the report, print the total balances forward, total deposits, total withdrawals, total interest earned and total final account balances.

Calculate_final_account_balance
Print_detail_line
Print end_of_report

Perform_initial_processing
Set page_count, line_count to zero
Print_page_headings (line_count)
Read savings_account_records
DOWHILE more savings_account_records
IF line_count > 45 THEN
Print_page_headings (line_count)
ENDIF
MODULE
Calculate_final_account_balance
Print_detail_line (Account_num,Balance_forward, Sum_of_deposits, Sum_of_withdrawals, Final-_account_balance, line_count)
Read savings_account_record
ENDDO
END
MODULE
Print_page_headings (line_count)
add 1 to page_count
Print main heading
Print column headings
Print blank line
Set line_count to zero
END

Calculate final_account_balance =
(balance_forward+deposits-withdrawals+interest)
Print_detail_line (Account_num,Balance_forward, Sum_of_deposits, Sum_of_withdrawals, Final-_account_balance, line_count)
add 1 to line_count
Print end_of_report (Total_balances_forward, total_deposits, total_withdrawals, total_interest_earned, total_final_account_balances)
add 1 to line_count
END

It looks like a very good start for the pseudocode.

I would give the following comments:
1. include the definition of variables at the beginning of the pseudocode, as well as the type (int, double, etc.). If necessary, give a description.
2. You have included a lot of details of reading and printing, that is good.
3. Give the exact operations you plan to do with the variables, example,
- for a deposit, add the amount to the account balance.
- for a withdrawal, verify if the withdrawal exceeds the balance. If exceeded, print a message to that effect and cancel the withdrawal.
If the amount is not exceeded, proceed with the withdrawal (i.e. deduct the withdrawal amount from the account balance).
These checks should be done BEFORE each transaction is processed.

Also, it will help reading if you make a distinction between comments
"Read savings_account_record" is a comment, and
"Get final_account_balance "
is a computer executable statement.
You can put REM before comments (as in VB) or // (as in Java).

Here's a step-by-step breakdown of the algorithm:

1. Initialize variables:
- Set line_count, total_deposits, total_withdrawals, total_interest_earned to zero.

2. Perform initial processing:
- Set page_count and line_count to zero.
- Print page headings.

3. Read savings account record:
- Read the first savings_account_record.

4. Loop through all savings account records:
- DOWHILE NOT EOF (end of file):
- Calculate the final account balance as balance_forward + deposits - withdrawals + interest.
- Print the detail line displaying account number, balance forward, deposits, withdrawals, interest earned, and final account balance.
- Increase line_count by 1.
- Check if line_count exceeds 45. If it does, print page headings again and reset line_count to zero.
- Read the next savings_account_record.

5. Print end of report:
- Print "Final account balance = " followed by the final_account_balance.
- Print "Total balances forward = " followed by total_balance_forward.
- Print "Total deposits = " followed by total_deposits.
- Print "Total withdrawals = " followed by total_withdrawals.
- Print "Total interest earned = " followed by total_interest_earned.
- Print "Total final account balances = " followed by total_final_account_balances.

Note: The actual implementation of the algorithm may vary depending on the programming language being used.

To design an algorithm that produces a savings account balance report, you can follow the steps described below:

1. Initialize the variables: Set line count, total deposits, total withdrawals, and total interest earned to zero.

2. Process the savings account records:
a. Read the first savings account record.
b. Get the final account balance by calculating it as balance forward + deposits - withdrawals + interest.
c. Start a loop to process each savings account record until the end of the file is reached.
d. Calculate the final account balance for the current record.
e. Print a detail line for the current record showing account number, balance forward, deposits, withdrawals, interest earned, and final account balance.
f. Read the next savings account record.
g. Get the final account balance for the next record.
h. Repeat steps d to g until all savings account records have been processed.

3. Print the report summary:
a. Print the final account balance.
b. Print the total balances forward, total deposits, total withdrawals, total interest earned, and total final account balances.

4. Create helper modules to perform specific tasks:
a. Calculate_final_account_balance: This module calculates the final account balance using the formula (balance_forward + deposits - withdrawals + interest).
b. Print_detail_line: This module prints the detail line for each savings account record.
c. Print_end_of_report: This module prints the end of the report, including the total balances forward, total deposits, total withdrawals, total interest earned, and total final account balances.
d. Perform_initial_processing: This module performs initial processing tasks such as setting variables and printing page headings.
e. Print_page_headings: This module prints the page headings at the top of each page.

Here is the algorithm for solving the problem:

MAINLINE
Perform_initial_processing
Read savings_account_record
Get final_account_balance
Set line count, total deposits, total withdrawals, and total interest earned to zero
DOWHILE NOT EOF
Calculate_final_account_balance
Print detail_line
Read savings_account_record
Get final_account_balance
ENDDO
Print 'Final account balance = ', final_account_balance
Print 'Total balances forward = ', total_balance_forward
Print 'Total deposits = ', total_deposits
Print 'Total withdrawals = ', total_withdrawals
Print 'Total interest earned = ', total_interest_earned
Print 'Total final account balances = ', total_final_account_balances
END

MODULE Perform_initial_processing
Set page_count, line_count to zero
Print_page_headings(line_count)
Read savings_account_records
DOWHILE more savings_account_records
IF line_count > 45 THEN
Print_page_headings(line_count)
ENDIF
ENDDO
END

MODULE Calculate_final_account_balance
final_account_balance = (balance_forward + deposits - withdrawals + interest)
Print_detail_line(Account_num, Balance_forward, Sum_of_deposits, Sum_of_withdrawals, Final_account_balance, line_count)
Read savings_account_record
ENDDO
END

MODULE Print_page_headings(line_count)
Add 1 to page_count
Print main heading
Print column headings
Print blank line
Set line_count to zero
END

MODULE Print_detail_line(Account_num, Balance_forward, Sum_of_deposits, Sum_of_withdrawals, Final_account_balance, line_count)
Add 1 to line_count
Print detail line with the values of Account_num, Balance_forward, Sum_of_deposits, Sum_of_withdrawals, and Final_account_balance
END

MODULE Print_end_of_report(Total_balances_forward, total_deposits, total_withdrawals, total_interest_earned, total_final_account_balances)
Add 1 to line_count
Print end of report with the values of Total_balances_forward, total_deposits, total_withdrawals, total_interest_earned, and total_final_account_balances
END

Note: Make sure to replace the placeholder values with the actual variable names and adjust the code according to the programming language you are using.