Howdy. 

This is where we document code written in the second lecture (09:30am).

Final Exam in amonth. 

Exam Three in a week: Homework Seven material. 

Homework Eight and Nine difficult, extended by one week each.

If you think you can do something or if you think you can't do it you're probably right. 

BlueJ book, read it.

Study Guide for Exam Three to be posted on Wed. 

Code developed in class:

class Circle {
  Point center; 
  int radius;
  Circle(Point p, int radius) {
    this.center = p;
    this.radius = radius;
  }
  boolean overlaps(Circle other) {
    return !(other.center.distanceTo(this.center) > this.radius + other.radius); 
  }
  boolean contains(Point p) {
    return (this.center.distanceTo(p) <= this.radius) ;
  } 
}


class Point {
  int x, y;
  Point(int x, int y) {
    this.x = x; 
    this.y = y; 
  }
  double distanceTo(Point another) {
    int dx = this.x - another.x; 
    int dy = this.y - another.y; 
    return Math.sqrt( dx * dx + dy * dy );
  }
}

class Example {
  public static void main(String[] args) {
    Circle a, b;
    Point c;
    a = new Circle(new Point(0, 0), 7);
    b = new Circle(new Point(2, 3), 2);
    c = new Point(-2, 5); 
    System.out.println( a.overlaps(b) ); // true 
    System.out.println( b.contains(c) ); // false 
  }
  static boolean overlaps(Circle a, Circle b) {
    return a.overlaps(b); 
  } 
}

Question: how do we sort an array of objects? 

Hint: What is Comparable? 

Another Hint: What is a Comparator? 

--