You are on page 1of 3

Appendix G

IT/210 Version 5

Associate Program Material


Appendix G
Sequential and Selection Process Control Structure
In the following example, the second line of the table specifies that tax due on a salary of
$2,000.00 is $225.00 plus 16% of excess salary over $1,500.00 (that is, 16% of $500.00).
Therefore, the total tax is $225.00 + $80.00, or $305.00.

1.
1
2.
2
3.
3
4.
4
5.
5

Salary Range in Dollars


0.00-1,499.99

Base Tax in Dollars


0.00

Percentage of Excess
15 %

1,500.00-2,999.99

225.00

16 %

3,000.00-4,999.99

465.00

18 %

5,000.00-7,999.99

825.00

20 %

8,000.00-14,999.99

1425.00

25 %

Problem Analysis:
Process:
1.
2.
3.
4.

Display welcome message with program title


Get the salary
Calculate the taxes
Output the results

Input:
Salary

(real: Salary)

Output:
Total taxes
Salary

(real: Taxes)

Input-Process-Output Chart
Input
Salary (from keyboard)
Salary
Salary, Taxes
Pseudocode
Main program

Processes
Get Salary
Calculate Taxes
Output Taxes

Output
Salary
Taxes
Salary, Taxes (to display)

Appendix G
IT/210 Version 5

Declare Salary as real


Declare Taxes as real
Display Welcome to the Progressive Tax Calculator System.
Call Get Salary Module
Call Calculate Taxes Module
Call Display Taxes Module
End Program
Get Salary
Write Enter the Salary:
Get Salary
Get Salary
Calculate Taxes
Declare BaseTax as real
Declare Excess as real
Declare Rate as real
If(Salary <= 0 OR Salary >= 15000.00)
Display Invalid Salary
Set BaseTax = 0.0
Set Rate = 0.0
Set Excess = 0.0
Else
If(Salary <= 1499.99)
Set BaseTax = 0.0
Set Rate = 0.15
Set Excess = Salary
Else
If (Salary <= 2999.99)
Set BaseTax = 225.00
Set Rate = 0.16
Set Excess = Salary 1500.00
Else
If (Salary <= 4999.99)
Set BaseTax = 465.00
Set Rate = 0.18
Set Excess = Salary 3000.00
Else
If (Salary <= 7999.99)
Set BaseTax = 825.00
Set Rate = 0.20
Set Excess = Salary 5000.00
Else
Set BaseTax = 1465.00
Set Rate = 0.25
Set Excess = Salary 8000.00
End If
End If
End If
End If

Appendix G
IT/210 Version 5

Set Taxes = BaseTax + (Excess*Rate)


End Calculate Taxes
Display Taxes
Display Salary = $, Salary, taxes = $, Taxes
End Display Taxes
Test Values
Input
Salary = 0.0
Salary = 15000.00
Salary = 0.01
Salary = 1000.00
Salary = 1499.99
Salary =1500.01
Salary = 2000.00
Salary = 2999.99
Salary =3000.01
Salary = 4000.00
Salary = 4999.99
Salary =5000.01
Salary = 6000.00
Salary = 7999.99
Salary =8000.01
Salary = 12000.00
Salary = 14999.99

Expected Output
Error Message
Salary = $0.0
Taxes = $0.0
Error Message
Salary =$ 0.0
Taxes = $0.0
Salary = $0.01
Taxes = $0.0015
Salary = $1000.00
Taxes = $150
Salary = $1499.00
Taxes = $225.00
Salary = $1500.01
Taxes = $225.00
Salary = $2000.00
Taxes = $305.00
Salary = $2999.00
Taxes = $465.00
Salary = $3000.01
Taxes = $465.00
Salary = $4000.00
Taxes = $645.00
Salary = $4999.00
Taxes = $825.00
Salary = $5000.01
Taxes = $825.01
Salary =$ 6000.00
Taxes = $1025.00
Salary = $7999.00
Taxes = $1425.00
Salary = $8000.01
Taxes = $825.01
Salary = $12000.00
Taxes = $2425.00
Salary = $14999.00
Taxes = $3175.00

Comments
input out of valid range
input out of valid range
lower limit of first tax interval
middle of first tax interval
upper limit of first tax interval
lower limit of second tax interval
middle of second tax interval
upper limit of second tax interval
lower limit of third tax interval
middle of third tax interval
upper limit of third tax interval
lower limit of fourth tax interval
middle of fourth tax interval
upper limit of fourth tax interval
lower limit of fifth tax interval
middle of fifth tax interval
upper limit of fifth tax interval

You might also like