_Sequential_and_Selection_Processing

# _Sequential_and_Selection_Processing - and take note of...

This preview shows pages 1–2. Sign up to view the full content.

1 Write "Enter Salary" 2 read sal 3 4 if (sal < 1500) then 5 Tax = sal * .15 6 7 if (sal > 1499.99) AND (sal < 3000) then 8 Tax = 225 + (sal - 1500) * .16 9 10 if (sal > 2999.99) AND (sal < 5000) then 11 Tax = 465 + (sal - 3000) * .18 12 13 if (sal > 4999.99) AND (sal < 8000) then 14 Tax = 825 + (sal - 5000) * .20 15 16 if (sal > 7999.99) AND (sal < 15000) then 17 Tax = 1425 + (sal - 8000) * .25 18 19 20 write "The tax is" Tax Here are some test input and outputs: enter salary 600 The tax is 90 enter salary 1600 The tax is 241 enter salary 7000 The tax is 1225 enter salary 10000 The tax is 1925 To do a design walkthrough you should pretend that you are the computer

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
running this program. Try various inputs and the step through each line of code in the program
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: and take note of what would happen. When we run this program: Line 1 prints Enter Salary Lets say the user types in, 600 then variable sal will be set equal to 600 We see that the condition in the line 4 if statement will be true. Because 600 is less than 1500 So the computer will multiply sal * .15 OR (600 * .15) so the answer is 90. the computer sets the variable tax = 90 We can see that the condition in line 7 line 10 line 13 and line 16 is not true so nothing happens. Line 20 prints out: The tax is 90 The screen on your computer would look like this: Enter salary 600. The tax is 90....
View Full Document

## This note was uploaded on 05/01/2010 for the course AAIT IT 210 taught by Professor Yurik during the Spring '10 term at University of Phoenix.

### Page1 / 2

_Sequential_and_Selection_Processing - and take note of...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online