The hardest part about programming is figuring out how to get the computer to do what you want it to do. Once you determine how you would solve a task, you must then specify statements in the computer's programming language that would do the same thing. The problem here is that you must specify EVERYTHING down to the smallest detail to the computer. Humans are smarter than computers, because we can make and understand assumptions about the smaller details.
if ( cond ) statement
where: if a keyword of the language cond the conditional expression which will be evaluated to either true or false statement the other statement(s) that will get execute if the conditional expression evaluates to true.
The relational operators are:
The boolean operators are:
= = equal to != not equal to < less than < less than or equal to > greater than >= greater than or equal to
&& and || or ! not
if ( cond ) statement1 else statement2
where: if a keyword of the language cond the conditional expression which will be evaluated to either true or false statement1 the other statement(s) that will get execute if the conditional expression evaluates to true, the "if clause" else a keyword of the language statement2 the other statement(s) that will get execute if the conditional expression evaluates to false, the "else clause"
if ( cond1 ) statement1 else if ( cond2 ) statement2 else if ( cond3 ) statement3 ... else if ( condN ) statementN else statementN+1
For this lab assignment, complete the following:
Enter Yearly Income: Your Income Tax is:
The income tax will be a graduated tax, similar to what is used by the federal government. We will use the following tax information:
You will want to use the JavaScript if statement to have your code determine which tax bracket the user falls into.
Income Range Tax $0 - $2,000 Nothing $2,001 - $20,000 4% * Each dollar earned over $2,000 $20,001 - $40,000 $720 + 8% * Each dollar earned over $20,000 $40,001 - $80,000 $2,320 + 16% * Each dollar earned over $40,000 $80,001 - $120,000 $8,720 + 24% * Each dollar earned over $80,000 $120,001 + $18,320 + 32% * Each dollar earned over $120,000
Verify that your link and the file are viewable via a web browser from the URL of:
http://www.cs.uic.edu/~USERID where USERID is your CS account login name.You can check this out via the link to your home page on the CS 101 Student List page. Once you are at your home page, follow the link you added to your home page for this lab assignment.
To use the UNIX turnin command to electronically hand-in your html file using the project name of lab7. To submit the file in <filename> for lab7, the turnin command is entered as:
turnin -c cs101 -p lab7 <filename>To verify what you submitted using the turnin command type:
turnin -c cs101 -p lab7 -v