1. Distance formula:

public static double distance(double x1, double y1, double x2, double y2) {
    return Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));

Note that the keyword static is not essential for this problem, althugh we will learn why it makes sense later in the semester.

Refer to the Cow problem from the beginning of the semester for #2.