# Checkpoint Iteration Control Structure

Topics: Ring Pages: 5 (595 words) Published: May 13, 2011
Axia College 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 \$2000.00 is \$225.00 plus 16% of excess salary over \$1500.00 (that is, 16% of \$500.00). Therefore, the total tax is \$225.00 + \$80.00, or \$305.00.

| |Salary Range in Dollars |Base Tax in Dollars |Percentage of Excess | |1 |0.00-1,499.99 |0.00 |15 % | |2 |1,500.00-2,999.99 |225.00 |16 % | |3 |3,000.00-4,999.99 |465.00 |18 % | |4 |5,000.00-7,999.99 |825.00 |20 % | |5 |8,000.00-14,999.99 |1425.00 |25 % |

Main Module

Declare Associate_Name as string
Declare Salary_Amount as real
Declare Base as real
Declare Excess as real
Declare Salary as real
Declare Start_Over as string

REM these are the calls for the modules that can be ran. Not all modules will run REM because associates will only fall into 1 tax bracket

Call Input Data Module
Call Range Module
Call Salary1 Module
Call Salary2 Module
Call Salary3 Module
Call Salary4 Module
Call Salary5 Module
Call Output Module
End Main Module

Input Data Module

Write, “Please Enter Associate’s Full Name”
Input Associate_Name

Write, “Associates Salary Amount?”
Input Salary_Amount

Call Range Module
End Input Data Module

Range Module

REM these statements (if, then, else) will determine what module to call upon.

If Salary_Amount < 1,499.99
Then Call Salary1 Module

Else
If Salary_Amount > 1,500.00 AND Salary_Amount < 2,999.99
Then Call Salary2 Module

Else
If Salary_Amount > 3,000.00 AND Salary_Amount < 4,999.99
Then Call Salary3 Module

Else
If Salary_Amount > 5,000.00 AND Salary_Amount < 7,999.99
Then Call Salary4 Module

Else
If Salary_Amount > 8,000.00 AND Salary_Amount < 14,999.99
Then Call Salary5 Module

Else
Write,” The salary you typed in is not computable.“
Write,” Please enter a salary between 0.00 and 14,999.99.” Call Input Module
End Range Module

Salary 1 Module
Declare Excess as real
Declare Salary as Real
Set Excess = Salary_Amount * .015
Set Salary = Salary_Amount - Excess
Call Output Module
End Salary 1 Module

Salary 2 Module
Declare Base as real
Declare Excess as real
Declare Salary as real
Set Base = Salary_Amount - 225
Set Excess = Base * .16
Set Salary = Base - Excess
Call Output Module
End Salary 2 Module

Salary 3 Module
Declare Base as real
Declare Excess as real
Declare Salary as real
Set Base = Salary_Amount - 465
Set Excess = Base * .18
Set Salary = Base - Excess
Call Output Module
End Salary 3 Module

Salary 4 Module
Declare Base as real
Declare Excess as real
Declare Salary as real
Set Base = Salary_Amount - 825
Set Excess = Base * .20
Set Salary = Base - Excess
Call Output Module
End Salary 4 Module

Salary 5 Module
Declare Base as real
Declare Excess as real
Declare Salary as real
Set Base = Salary_Amount - 1425
Set Excess = Base * .25
Set Salary = Base - Excess
Call Output Module
End Salary 5 Module

Output Module
Declare Start_Over as string
Declare Associate_Name as string
Declare Salary as real
Write,” The gross salary for,” Associate_Name

Salary

Write, “Wanna start this from the beginning? Enter Y or N” Input Start_Over

If Start_Over = “Y” or “y”
Then Call Input Module

Else
If Start_Over = “N” or “n”
Then End

Else

End
End Output Module

Input...