Download presentation
Presentation is loading. Please wait.
Published byJudith Leonard Modified over 9 years ago
1
Week 11 - Friday
2
What did we talk about last time? Object methods Accessors Mutators Constructors Defining classes
7
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
8
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
9
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
10
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
13
Exam 2 post mortem More object examples Class variables and constants Big Oh notation
14
Keep working on Project 4 Due next Friday
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.