class Point { public double x; public double y; public Point(double px, double py) { this.x = px; this.y = py; } public double distanceTo(Point other) { double dx = this.x - other.x; double dy = this.y - other.y; return Math.sqrt(dx * dx + dy * dy); } } class Circle { public Point center; public double radius; public Circle(Point c, double r) { this.center = c; this.radius = r; } public double area() { return 3.14159 * this.radius * this.radius; } public double circumference() { return 2.0 * 3.14159 * this.radius; } } class Rectangle { public double width; public double height; public Rectangle(double w, double h) { this.width = w; this.height = h; } public double area() { return this.width * this.height; } public double perimeter() { return 2.0 * (this.width + this.height); } public double diagonal() { return Math.sqrt(this.width * this.width + this.height * this.height); } } Point p1 = new Point(0.0, 0.0); Point p2 = new Point(3.0, 4.0); p1.distanceTo(p2) Circle c = new Circle(new Point(0.0, 0.0), 5.0); c.area() c.circumference() Rectangle r = new Rectangle(3.0, 4.0); r.area() r.perimeter() r.diagonal() %classes %whos %quit