Classes, Objects, and References

What's the difference between a "class" and an "object"?

 
 		
		



















What are some of the "attributes" of Dogs?

What can some of the "behaviors" of Dogs?

What are some of the "attributes" of Books?

What can some things we can do with Books?

What are some specific Book "objects"?

title: 

author:

number of pages:


title:

author:

number of pages:


title:

author:

number of pages:


What are the different parts of a Java class?

 
















What's a "method"?

 
 		
	





What are the parts of a method?




    int minimum(int x, int y) {

      if (x < y)
  
        return x;
    
      else
   
        return y;
  
    }

What is an "overloaded" method?

















    int sum(int x, int y) {

      return x + y;
  
    }


    int sum(int x, int y, int z) {
 
      return x + y + z;
  
    }



What are the two kinds of methods(ADVANCED)?














Why do we want to define classes anyway? What is "object-oriented" programming?

 
 



















Designing the TRACS System
























/**
 * Course class for TRACS system
 * @author Suzanne Balik, 7 Feb 2003
 */
public class Course{

  private String name;
  
  private String courseNumber;
  
  private int capacity;
  
  private int numberOfStudents;
  
  
  public Course(String name, String courseNumber, int capacity) {
  







  }
  public String getName() {
 
 
 
 
  }
  public String getCourseNumber() {
   
 
 
  }
  public int getNumberOfStudents() {
  

    
  }
  public boolean courseFull() {








  }
  //Add students and return true if there's room in course,
  //Otherwise, return false
  public boolean addStudents(int numberToAdd) {
 
 
 
 
 
 
 
 
 
  }
  
  public static void main(String[] args) {
  
    Course csc116 = new Course("Intro to Programming", 
                               "CSC116-001", 120);
    
    //Create another reference to the same object called sameCourse
    


















  }
}