// A program that deals with 2D points.
// Fifth version, to accompany Point class with toString method.
import java.util.*;

public class PointMain1 {
    public static void main(String[] args) {
        // create two Point objects
        Point p1 = new Point(7, 2);
        Point p2 = new Point(4, 3);

        // print the points
        System.out.println("p1 is " + p1);
        System.out.println("p2 is " + p2);
	// Put them in an ArrayList:
	ArrayList<Point> pts = new ArrayList<Point>();
	pts.add(p1);
	pts.add(p2);
	// print them in ArrayList:
	System.out.println(pts);
	// Find distance from origin of first pt in pts:
	System.out.println("dist = " + pts.get(0).distanceFromOrigin());
	// Find (4,3):
	System.out.println("(4,3) is at index " + pts.indexOf(new Point(4,3)));
	System.out.println("(4,3) is contained in pts? " + pts.contains(new Point(4,3)));
	System.out.println("(4,3) equals p2? " + p2.equals(new Point(4,3)));
    }
}
