{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

06-feb04 - COMP110 If/ TabithaPeckM.S February4,2008...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
COMP 110 If / Else and Case Statements Tabitha Peck M.S. February 4, 2008 MWF 3-3:50 pm Philips 367 1
Background image of page 1

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

View Full Document Right Arrow Icon
Announcements New Homework Policy Incorrect submissions == lose a letter grade Three incorrect submissions == zero credit Check .jar files BEFORE you send them See me if you are still having problems Grades Lab 1, Lab 2, Project 1 Posting Grades online? Handing back grades? 2
Background image of page 2
Questions? 3 From Lab 2 No real problems Never got the same problem twice
Background image of page 3

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

View Full Document Right Arrow Icon
Gotcha == var1 = var2 (assignment statement) Error!!!!!!! var1 == var2 (boolean expression) Do NOT use == to compare Strings string1 == string2 //BAD string1.equals(string2); //GOOD 4
Background image of page 4
Gotcha (Syntax) if (boolean expression); DO NOT DO THIS!!!!!!!
Background image of page 5

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

View Full Document Right Arrow Icon
Today in COMP 110 More if / else statements Case statements 6
Background image of page 6
Tracing if / else code I give you code and input You give me output 7
Background image of page 7

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

View Full Document Right Arrow Icon
Example input = 5? input = 6? int days = 0; if (input < 6) System.out.print(“I worked “ + input + “days this week”); else { days = 6 – input + 1; System.out.print(“I worked “ + days + “ days of overtime”); } 8
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}