Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. package cse1102.geometry;
  2.  
  3. public class Vertex
  4. {
  5.  
  6. private int x;
  7. private int y;
  8.  
  9.  
  10.  
  11. public Vertex()
  12. {
  13. this.x = 0;
  14. this.y = 0;
  15. }
  16.  
  17. public Vertex(int x, int y)
  18. {
  19. this.x = x;
  20. this.y = y;
  21. }
  22.  
  23.  
  24.  
  25. public int getX()
  26. {
  27. return x;
  28. }
  29.  
  30. public void setX(int x)
  31. {
  32. this.x = x;
  33. }
  34.  
  35. public int getY()
  36. {
  37. return y;
  38. }
  39.  
  40. public void setY(int y)
  41. {
  42. this.y = y;
  43. }
  44.  
  45.  
  46.  
  47. public void deltaMove(int deltaX, int deltaY)
  48. {
  49. this.x = this.x + deltaX;
  50. this.y = this.y + deltaY;
  51. }
  52.  
  53. public String toString()
  54. {
  55. String message = "Type : Vertex" + "\n" +
  56. "X Coordinate : " + this.x + "\n" +
  57. "Y Coordinate : " + this.y + "\n" ;
  58.  
  59. return message;
  60. }
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement