CS141: Topics for the Week of Oct 10, 2011
Topics & Activities
Mon: Go over Technews assignment.
NetLogo
and course on
Computer Models/Environmental Simulation
Maria Klawe
: Attracting more Women into Computer Science
Chapter 4 Loops
Nested loops (see lab).
Chapter 5 Methods
What is a method?
Why do we have methods?
Organization
Modularization and Reusability
Efficiency - reduce repetition in code, e.g. look at
light-Bot
.
Anatomy of a Method Declaration:
method name
parameters (type & name for each)
return type
body
What does it mean "to call" a method.
Example: Rolling dice - see
in class problems
.
What is the scope of a variable?. Declaring variables local to a block of code.
In Lab:
Follow the instructions:
Lab 6: Nested Loops