Pseudocode help please

I am taking my first Programming Logic and Design class. We have not yet learned about any specific languages, just the logic using pseudocode. Unfortunately I took an online class and the professor is helpless so I am completely lost.

Please help me out here!



/* This program keeps a running total of items in a grocery checkout line as well as the number of items purchased. At the end the number of items and a total cost of the items are reported. But there are a few bugs. See if you can find them.

start
Declarations
num total
num itemCost
num numItems

housekeeping()
while itemCost > 0
detailLoop()
endwhile
endOfJob()
stop


housekeeping()
numItems = 1
output "What is the cost of item ", numItems, "? (0 to quit) "
input itemCost
return


detailLoop()
total = total + itemCost
numItems = numItems + 1
output "What is the cost of item ", numItems, "? (0 to quit) "
input itemCost
return


eoj()
output "You purchaced ", numItems, " at a cost of $", total
output "Here is your reciept. Thank you!"
return
So I think one of the mistakes is the num total has to be declared as 0 in the Housekeeping module.

From what I understand, the loop will never come to an end as the itemcost will always be greater than 0

I cannot figure out how to implement an exit

please help
if they did not define the pseudo code language for you (some places do this), just type return or exit or end or whatever word you like.

if user input = 0
return

?? Like that?
Topic archived. No new replies allowed.