Construct the pseudocode for the following problem Assume th
Construct the pseudocode for the following problem: Assume that each input record contains a taxpayer’s name, the value of a personal property belonging to the taxpayer, and a code defining the type of personal property owned. Each type of property is taxed at a unique rate. The codes, property types, and tax rates follow:
Code
Property type
Tax Rate
1
Bike
2 percent of value
2
Car
4 percent of value
3
Truck
5 percent of value
Your program is to compute the tax for each property and to output a line specifying each taxpayer’s name, value of property, and tax. The program should output counts of the numbers of bikes, cars, and trucks for which taxes are computed. Output an error message if the input contains an invalid code. Assume a code of 0 indicates the end of the input file or when loop stops.
| Code | Property type | Tax Rate |
| 1 | Bike | 2 percent of value |
| 2 | Car | 4 percent of value |
| 3 | Truck | 5 percent of value |
Solution
function compute_tax( ):
totalBikes = 0
totalCars = 0
totalTrucks = 0
while true:
record = read_another_record( input file )
tax = 0
if record.code == 0
break;
else if record.code == 1
tax = 0.02*record.propValue
totalBikes = totalBikes + 1
print record.name, record.propValue, tax
else if record.code == 2
tax = 0.04*record.propValue
totalCars = totalCars + 1
print record.name, record.propValue, tax
else if record.code == 3
tax = 0.05*record.propValue
totalTrucks = totalTrucks + 1
print record.name, record.propValue, tax
else
print \'Invalid code\'
print totalBikes
print totalCars
print totalTrucks
