Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class RunPoint {
- public static void main(String[] args) {
- System.out.println("The program created " + Point.getCount() + " points");
- Point p1 = new Point(43, 7);
- Point p2 = new Point(5, 5);
- System.out.println(p1);
- System.out.println(p2);
- System.out.println("----------------------");
- double tempX;
- tempX = p1.getX(); // 1
- p1.setX(p2.getX()); // 2
- p2.setX(tempX); // 3
- System.out.println(p1);
- System.out.println(p2);
- // distance from p1 to p2
- System.out.println(p1.distance(p2));
- if (p1.distance(p2) > 10) {
- System.out.println("too far");
- }
- // mid point
- System.out.println("Mid Point is " + p1.middle(p2));
- Point p3 = p1;
- System.out.println("p1:" + p1);
- System.out.println("p3:" + p3);
- Point p4 = new Point(p1.getX(), p2.getY() + p1.getY());
- System.out.println("p4: " + p4);
- p1.setX(100);
- System.out.println("p1:" + p1);
- System.out.println("p3:" + p3);
- System.out.println(p3.distance(p4));
- System.out.println(p3.middle(p4));
- System.out.println("The program created " + Point.getCount() + " points");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement