// Allison Obourn
// CS& 141, Winter 2021
// Lecture 14

// Blueprint for creating objects of type Point
// which represents a location on a 2D x, y plane

// NOTE: This class is not finished yet and therefore not a good 
//       style example! We will finish writing this code next class

import java.awt.*;

public class Point {
  int x;
  int y;
  
  // Creates a Point with the provided x and y 
  // coordinates
  public Point(int startX, int startY) {
     x = startX;
     y = startY;
  }
  
  // Creates a Point with x and y coordinates
  // set to the origin
  public Point() {
     x = 0;
     y = 0;
  }
   
   // Draws a point as a dot with a coordinate label
   // with the provided Graphics g
  public void draw(Graphics g) {     
      g.fillOval(x, y, 3, 3);
      String label = toString();
      g.drawString(label, x, y);
      
   }
   
   // Moves the Point's x and y by a provided dx and 
   // dy amount
   public void translate(int dx, int dy) {
      x += dx;
      y += dy;
   }
   
   // returns a String in the format of (23, 42)
   // where the numbers are the x and y coordinates
   public String toString() {
      return "(" + x + ", " + y + ")";
   }
}