CS51 - Spring 2010 - February 9

  • Discussion of formal/actual parameters

  • While loops
  • Syntax:
                while ( < ... condition ... > ) {
    
                     // body of loop containing statements to be executed
    
                }
            
  • Railroad
  • WhileRailroad
  • Brief discussion of more complex loops: Knitting
  • Active Objects
  • animation as a while loop with a pause
  • using active objects requires:
  • class that extends ActiveObject
  • last line in constructor is start()
  • the run() method specifies what the animation should do. Make sure there's a pause statement
  • PatheticPong
  • Boxball lab
  • Note that there are 3 classes, links to what will be in the starter file at the page above.
  • Design: think carefully about how parameters need to be used.
  • Working with images: Snowman