A town contains a total of 5000 houses. Every house owner has to pay tax based on value of the house. Houses over $200 000 pay 2% of their value in tax, houses over $100 000 pay 1.5% of their value in tax and houses over $50 000 pay 1% of their value in tax. All others pay no tax. Write an algorithm to solve this problem using pseudocode.
for count = 1 to5000
input house
if house > 50 000 then tax = house * 0.01
else if house > 100 000 then tax = house * 0.015
else if house > 200 000 then tax = house * 0.02
else tax = 0
print tax
next
Notes: (1) a while loop or a repeatloop would have worked just as well
(2) The use of endif isn't essential in the pseudocode
For illustration,
count = 0
while count < 5001
input house
if house > 50 000 then tax = house * 0.01
else if house > 100 000 then tax = house * 0.015
else if house > 200 000 then tax = house * 0.02
else tax = 0
endif
endif
endif
print tax
count = count + 1
endwhile