Advertisement
Guest User

Untitled

a guest
May 29th, 2015
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. package Point;
  2.  
  3. public class Point
  4. {
  5. private double x, y;
  6. public double getX()
  7. {
  8. return this.x;
  9. }
  10. public double getY()
  11. {
  12. return this.y;
  13. }
  14.  
  15. public Point(double nx, double ny)
  16. {
  17. x = nx;
  18. y = ny;
  19. }
  20.  
  21. public double sumupANDIncreaseBy(double dx)
  22. {
  23. return ++this.x + ++this.y + ++dx;
  24. }
  25. public static void main(String[] args)
  26. {
  27. Point p1 = new Point(3, 3);
  28. double r = 5;
  29. System.out.println("p1.x = " + p1.getX() + ", p1.y = " +
  30. p1.getY() + "; " + "p1.sumupANDIncreaseBy(r) results in " +
  31. p1.sumupANDIncreaseBy(5)+ ", p1.x = " + p1.getX() + ", p1.y = "
  32. + p1.getY() + ", r = " + r);
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement