Sequential and Selection Process Control Structure Appendix G

561 Words3 Pages
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. Salary Range in Dollars Base Tax in Dollars Percentage of Excess 1. 1 0.00-1,499.99 0.00 15 % 2. 2 1,500.00-2,999.99 225.00 16 % 3. 3 3,000.00-4,999.99 465.00 18 % 4. 4 5,000.00-7,999.99 825.00 20 % 5. 5 8,000.00-14,999.99 1425.00 25 % Input-Process-Output Chart Input Process Output (keyboard) Get salary Sal (real) Sal (real) BaseTax (Float) PctExs (Float) Calculate the Tax Due Sal (real) BaseTax (Float) PctExs (Float) TaxDue (Float) Sal (real) BaseTax (Float) PctExs (Float) TaxDue (Float) Display the Tax Due (Output to screen) Flow Chart Main Module Calculate TaxDue Module Pseudo code Main Module Declare Sal as real numbers Declare TaxDue as Float Declare BaseTax as Float Declare PctExs as Float Declare ExtSal as Float Display “Please enter the salary amout” Input Sal Call Calculate TaxDue Module Call DisplayTaxDue Module End Main Module CalculateTaxDue Module DueTax = BaseTax + PctExs BaseTax = 0.00 PctExs = .15 If 0.00 ≤ Sal ≤ 1,499.99 Then BaseTax = 0.00 PctExs = (Sal – 0.00) * .15 End If If 1,500.00 ≤ Sal ≤ 2,999.99 Then BaseTax = 225.00 PctExs = (Sal – 1,500.00) * .16 End If If 3,000.00 ≤ Sal ≤ 4,999.99 Then BaseTax = 465.00 PctExs = (Sal – 3,000.00) * .18 End If If 5,000.00 ≤ Sal ≤ 7,999.99 Then BaseTax = 825.00 PctExs = (Sal – 5,000.00) * .20 End If

More about Sequential and Selection Process Control Structure Appendix G

Open Document