Question: How do I create a trace table for this? Module main ( ) Call showMsg ( ) Call user_input ( ) Call monthly_calculations (ref Integer
How do I create a trace table for this?
Module main ( )
Call showMsg ( )
Call user_input ( )
Call monthly_calculations (ref Integer monthsPassed)
Call displayOutput ( )
End module
Module showMsg ( )
Display "This program calculates your savings account balance, number of deposits, "
Display "number of withdrawals, and total interest earned over time."
End module
Module user_input ( )
Declare Real annual_interest_rate, balance
Declare Integer monthsPassed
Display "What is your account's starting balance?"
Input balance
Display "Please enter the annual interest rate for your account."
Input annual_interest_rate
Display "How many months have passed since your account was established?"
Input monthsPassed
End module
Module monthly_calculations ( )
Declare Real monthlyDeposit, monthlyWithdrawal, interest
Declare Real totalDeposit = 0, totalWithdrawal = 0
Declare Integer months = 1
Do
Display "How much money did you deposit in month ", months, "?"
Input monthlyDeposit
Set balance = balance + monthlyDeposit
Set totalDeposit = totalDeposit + monthlyDeposit
Display "How much money did you withdraw from your account in month ", months "?"
Input monthlyWithdrawal
Set balance = balance - monthlyWithdrawal
While months <= monthsPassed
Set interest = (annual_interest_rate /12) * balance
Set balance = balance + interest
End module
Module displayOutput ( )
Display "Since opening your account: "
Display "Your total savings account balance is $", balance , "."
Display "The total amount you have deposited is $", totalDeposit , "."
Display "The total amount you have withdrawn is $", totalWithdrawal , "."
Display "The total interest you have earned is $", interest , "."
End module
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
