// A standard mortgage is paid monthly over 30 years. // This program is intende
ID: 3537418 • Letter: #
Question
// A standard mortgage is paid monthly over 30 years.
// This program is intended to print 360 payment coupons
// for each new borrower at a mortgage comapny. Each coupon
// lists the month number, year number, and a friendly mailing reminder.
start
Declarations
num MONTHS = 12
num YEARS = 360
string MSG = "Remember to allow 5 days for mailing"
num acctNum
num monthCounter
num yearCounter
housekeeping()
while acctNUm <> QUIT
printCoupons()
endwhile
finish()
stop
housekeeping()
print "Enter account number or ", QUIT, " to quit "
return
printCoupons()
while yearCounter <= YEARS
while monthCounter <= MONTHS
print acctNum, monthCounter, yearCounter, MSG
monthCounter = monthCounter + 1
endwhile
yearCounter = yearCounter + 1
endwhile
output "Enter account number or ", QUIT, " to quit "
input acctNum
return
finish()
output "End of job"
return
Explanation / Answer
1. Take input from the user for how many years, the mortage has to be paid. (Here it is 30)
2. Multiply the input (fetched from step 1) * 12 to calculate the number of payment cupons. (Here it is 360)
3. Display a message or a friendly mailing remainder. "Remember to allow 5 days for mailing"
4. take input for account number
5. If no account number has to be given the type QUIT to quit the code.
6. Calculate the computation until QUIT is encountered.
6a. Initialize two variables for year and month counter.
6b For each month, print the account number, friendly mailer and other details such as yearly and monthly counter value
6c. Increment the monthly counter value by 1 after each print.
6c. If the monthly counter value is greater than 12, then increment the yearly counter by 1.
6d. If yearly counter value reaches the value of number of payment cupons (Here it is 360), terminate the loop
7. End of the program
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.