Monday, February 1, 2016

How to debug this pseudocode?


// This pseudocode segment is intended to compute and display
// the total monthly cost of home ownership for any number of
// homeowners. The total cost is equal to the sum of a
// homeowner’s monthly mortgage payment, utilities, and taxes.
// The program ends when a user enters 0 for the mortgage payment

start
Declarations
num mortgagePayment
num utilities
num taxes
num total
startUp()
while mortgagepayment not equal to 0
mainLoop()
endwhile
finishUp()
stop

startUp()
output "Enter your mortgage payment or 0 to quit"
output mortgagePayment
return

mainLoop()
output "Enter utilities"
input utilities
output "Enter taxes
input taxes
total = mortgagePayment * utilities * taxes
output "Total is ", total
output "Enter your mortgage payment or 0 to quit"
input mortgagePayment
return

finishUp()
output "End of program"
return

Read more: How to debug this pseudocode?