CIS110203 Intro to Computer Science Lab - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

CIS110203 Intro to Computer Science Lab

Description:

General Stuff ... General Stuff. Don't forget to use the bulletin board! ... Things I'll Assume You Know When I'm Explaining Stuff ... – PowerPoint PPT presentation

Number of Views:92
Avg rating:3.0/5.0
Slides: 17
Provided by: cat
Category:

less

Transcript and Presenter's Notes

Title: CIS110203 Intro to Computer Science Lab


1
CIS110-203Intro to Computer Science Lab 3
  • TA Catherine Stocker
  • Mentor Jay Fiddelman
  • University of Pennsylvania
  • 20 September 2007

2
Todays Agenda
  • Meet Jay
  • General Stuff
  • Homework
  • Exam
  • The While Loop and Pseudocode
  • Lab Work
  • Review Sheet

3
Monitors
  • Turn em off

4
Jay Fiddelman
  • Change in line up Anna is now a 2nd TA for a
    different lab.
  • Jay Fiddelman is now a mentor for this lab
    (jfidd_at_seas.upenn.edu).
  • A little about Jay

5
General Stuff
  • There will be a make-up lab for students missing
    next Thursday (9/27) - watch for the email and
    don't forget to email me if you're going to it.
  • TA's will now be holding their regular office
    hours there are lots of hours so come ask
    questions!

6
General Stuff
  • Dont forget to use the bulletin board! Lots of
    important info goes up there and all of us (TAs,
    mentors, graders, Jean) check it.
  • Shiftenter to go to next line in interactions
    pane without having your expression/statement
    evaluated
  • Useful for things like if-else statementsmay
    have caused problems for some of you trying to
    check your homework in DrJava

7
Homework
  • Jay is going to come around and check it out.
  • We'll go over it later if we have time.
  • How was it? How is class? How is life?

8
Exam 1
  • Next Tuesday (9/25) in class
  • 8-10pm exam review session Monday (9/24), listen
    for room announcement.
  • Review sheet (old exam questions) will be handed
    out at the end of class.
  • My study suggestion  Its easy to look at
    examples and explanations and say "yeah, that
    makes sense", but make sure you can actually do
    the explaining! 
  • 1) Look at the review sheet.
  • 2) Write out answers by hand (you'll be writing
    code by hand on the exam).
  • Type your solution into Dr.Java to see if it's
    correctif something went wrong, make sure you
    understand what it was.
  • 4) To really test your knowledge, try messing
    with the review questions and predicting the
    answers.

9
What Ill Assume When Explaining Stuff
  • When I type that means anything could have
    happened. So when you see my code look like
  • int x
  • int y
  • Assume theres a bunch of code and we can no
    longer assume we know what values x and y hold
    now (which is why we must test the value of x or
    y later)

10
Things Ill Assume You Know When Im Explaining
Stuff
  • That you understand the relationship between
    ! and all other operators -- because we will
    often not put parentheses around expressions
    using them. Generally know
  • !x in any situation is the same as (!x) (! has
    very high precedence)
  • xx is the same as (xx) ( and
    have lower precedence than relational
    operators)
  • Try to know the basics of precedence because
    people will often use shortcutsbut you should
    put parentheses all over your code unless youre
    absolutely sure of the precedence of your
    operators!

11
While Loops
  • While (condition) statement
  • Use braces! Only 1 case where you dont need to
  • Just like an if statement, only you keep going
    until the condition is no longer true
  • As long as the condition is true, only execute
    within the curly braces
  • Its your job to make sure the condition
    eventually becomes false

12
While Loops and Pseudocode
  • Whats the point?
  • Efficiency! If you have to perform the same task
    10 times, dont write it out 10 times (wastes
    time and space), just make a loop
  • Ex Find the largest of 10 positive numbers
    (pseudocode)
  • Declare and initialize the 10 variablesint
    max0 //variable to hold the max
    valueint x0 //counter to
    make sure we do the loop 10 timeswhile(x
  • compare the xth number to max, if
    its larger, its the new max.
  • x x1
  • Now do the while loop lab
  • Then, well go over homework solutions if we have
    time

13
Review Sheet
  • Typos
  • 5 \\ should be
  • 12 in the first section doesnt make sense
    because a,b,c are undefined variables
  • The answers will be posted this weekend, but do
    it on your own first!!!

14
Later
  • Check out our Siggraph Chapter
  • CIS 110 TA, Matt Kuruc, is the President!
  • Maya Tutorial on Saturday

15
Mod (Modulo) Operator
  • What does it do? Divides two numbers and returns
    the remainder
  • So if a/bc R d (Im not talking about assignment
    here, just plain old math) then abd
  • Concrete example 5/31R2 so 532
  • What happens when you do
  • 02?
  • 20?
  • -14?
  • 1.03.4?
  • Others?
  • Put them in the interactions pane and find out!

16
Where Might We Use the Mod Operator?
  • Write a calendar program... int yr
    2007 ...do stuff for the calendar... //don't
    forget leap years if((yr1000 yr4000)
    (yr100!0 yr40)) ...leap year, add
    feb 29th...
Write a Comment
User Comments (0)
About PowerShow.com