// A first attempt at a PointClient. There isn't much that is // inherently wrong with this program, but it can only work with // what is provided by the Point object. It would be better for // us to move some of the work that we currently have to do here // into the Point object. (string representation of the Point, // setting the Points initial x,y location, etc) public class PointClient1 { public static void main(String[] args) { // (3,5) Point1 p1 = new Point1(); p1.x = 3; p1.y = 5; System.out.println("p1.x = " + p1.x + ", p1.y = " + p1.y); p1.translate(2, 8); System.out.println("p1.x = " + p1.x + ", p1.y = " + p1.y); System.out.println("p1's distance from origin = " + p1.distanceFromOrigin()); // (10, -5) Point1 p2 = new Point1(); p2.x = 10; p2.y = -5; System.out.println("p2.x = " + p2.x + ", p2.y = " + p2.y); p2.translate(-5, 16); System.out.println("p2.x = " + p2.x + ", p2.y = " + p2.y); System.out.println("p2's distance from origin = " + p2.distanceFromOrigin()); } } // Miya's notes from lecture: // procedural programming // main method, run, DO some stuff // Object-Oriented programming (OOPSLA) // objects, conversations inbetween different kinds of objects // Objects // Scanners, Files, PrintStreams, Graphics, DrawingPanel // group related data together // state --> stuff we need to remember // behavior --> things we can ask our object to do // Scanner // state --> what file it's reading, cursor // behavior --> nextLine(), next(), nextInt(), hasNext() // Clients v. Implementors