Week 11 - Friday
What did we talk about last time? Object methods Accessors Mutators Constructors Defining classes
Let’s create a Student class Each Student will contain First Name: String Last Name: String GPA: double ID: int We need a constructor specifying each of these things, accessors to read them later, and mutators to change GPA and ID
Using the Student class, we can create a roster of students The roster is just an array of Student objects We’ll read in some student information from a file and create lots of Student objects Then, with our array, we can do some operations: Print out a nicely formatted roster Find the average GPA of all students Determine the valedictorian
We can make a Ball class Each Ball will have: Color: Color x Location: double y Location: double Radius: double x Velocity: double y Velocity: double We will need a constructor specifying these values and a method to update the position of the ball over time
With the Ball class created, it’s easy to make a program that shows balls bouncing all over the screen We simply create an array of Ball objects and update them repeatedly
Exam 2 post mortem More object examples Class variables and constants Big Oh notation
Keep working on Project 4 Due next Friday