CSE 113 Week 2 January 21 - 25, 2008

advertisement
CSE 113
Week 2
January 21 - 25, 2008
Monday Announcements
 No class Monday
Wednesday Announcements
 Pick up Syllabus
 Last day to drop/add is Friday
Wednesday Game Plan
 Variables
Wednesday
 Variables are ways to store the values
we are using.
 Variables are actually named storage.
Wednesday
 Declaring a variable:
type name;
Programmer decides what to name a
variable.
 Assigning a value to a variable
name = value;
 Note that assignment goes from right
to the left, the value is assigned to
the variable.
Wednesday
 You can also reassign variables.
int x = 5;
int y = 3;
x = y;
 What is the value of x now?
Friday Announcements
 Pick up Syllabus
 Today is the last day to drop/add
Spring 2008 classes
Friday Game Plan
 Exam 1 on Monday – discuss format
and topics
 Chapter 3 – working with objects
Friday
 Chapter 3 will not be on Exam 1.
 Creating an object
 new objectName();
 Can store objects in variables as well
 Let’s create a World
 World w = new World();
Friday
 Worlds can have Turtles in them.
 new Turtle (w);
 When we create new turtles, they
appear on top of the previous turtles
 We need a way to talk to each turtle
individually – a variable for each.
Download