Concerning algorithms in dry-running/trace tables?

Arty8

New member
1. What is the problem with this algo?
set the word to 'start'
set the total to 0
set the count to 0
while the word is not 'end'
read the next word
increase the count by one
set the amount to the number of letter 'e's in the word
increase the total by the amount
endwhile
set the average to total divided by count
output the average

dry run with fred,feed,compact,treecreeper,end

2.A shop sells items each of which has a unique id num.when a customer purchases an item, its id is entered at a terminal.a computer looks up this number in a file and returns the description and price of the item.After the last item a # is entered and the computer produces a total for all items purchased.The amount tendered is entered and the computer calculated the change. Part of the file of item stocked is shown;
write an algo to allow a till receipt to show:-the name of each article purchased
-its price
-the total cost of purchases
-the amount of customer offers
-the change due to the customer.

3.The oxygen content and temperature in a fish tank have to be controlled.Write an algo to acheive this.
 
Back
Top