Guest User

Untitled

a guest
Dec 23rd, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. public class Punkt{
  2.  
  3. private double x;
  4. private double y;
  5.  
  6. public Punkt(double x, double y) {
  7. this.x = x;
  8. this.y = y;
  9. }
  10. public Punkt przesuniecie(double a, double b) {
  11. this.x += a;
  12. this.y += b;
  13. return this;
  14. }
  15. public double odlegloscOdPocz() {
  16. this.x = x;
  17. this.y = y;
  18. return Math.sqrt(Math.pow(this.x , 2) + Math.pow(this.y , 2));
  19. }
  20. public String toString() {
  21.  
  22. return "(" + x + ", " + y + ")";
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment