Presentation is loading. Please wait.

Presentation is loading. Please wait.

March 2005 1R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Today: covering through P. 83 of textToday: covering through P. 83 of.

Similar presentations


Presentation on theme: "March 2005 1R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Today: covering through P. 83 of textToday: covering through P. 83 of."— Presentation transcript:

1 March 2005 1R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Today: covering through P. 83 of textToday: covering through P. 83 of text IF Statement PitfallsIF Statement Pitfalls IF – ELSE – IFIF – ELSE – IF Nested IFNested IF Compound Logical OperationsCompound Logical Operations

2 March 2005 2R. Smith - University of St Thomas - Minnesota Documentation Recap Put lab number in the file namePut lab number in the file name Page FormattingPage Formatting –Must print out on a vertical (portrait) page –“Wrap around” must be fixed by hand CommentComment –Heading comment: Name, contents (assignment), date –One on right of each variable declaration –One above every 2 to 5 statements, especially loops/ifs Leave a blank line before such a commentLeave a blank line before such a comment Indent statements inside curly bracesIndent statements inside curly braces –All statements align to the left –Indent inside curly braces –If statement must ‘wrap’, put the rest on next line, indented

3 March 2005 3R. Smith - University of St Thomas - Minnesota IF Statement Pitfalls ReviewReview –“Logical comparison” in parentheses –Skip the following statement if false –Put multiple statements in curly braces Putting a semicolon after the conditionPutting a semicolon after the condition Indenting several statements w/o bracesIndenting several statements w/o braces Not indenting after curly bracesNot indenting after curly braces

4 March 2005 4R. Smith - University of St Thomas - Minnesota More IF Features IF – ELSE – IFIF – ELSE – IF –So we can choose from alternatives –Example: Assigning grades Nested IFNested IF –Use curly braces to control the flow –Example: Loan money if 2 years on job and $1k a month “Boolean” Logical Operations“Boolean” Logical Operations –Boolean variables –! And && and || –Loan example revisited

5 March 2005 5R. Smith - University of St Thomas - Minnesota Lab 8 Adding overtime authorizationAdding overtime authorization Request # of hours of overtime authorizedRequest # of hours of overtime authorized –Authorized for this week’s hours –Overtime = hours greater than 40 per week If worker works those hours of overtimeIf worker works those hours of overtime –Then, those hours are paid at time and a half If worker works Unauthorized hoursIf worker works Unauthorized hours –Then, those hours are not paid at all

6 March 2005 6R. Smith - University of St Thomas - Minnesota

7 March 2005 7R. Smith - University of St Thomas - Minnesota Creative Commons License This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by- sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.


Download ppt "March 2005 1R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Today: covering through P. 83 of textToday: covering through P. 83 of."

Similar presentations


Ads by Google