Advertisement
Guest User

Untitled

a guest
May 25th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1. public class Punkt {
  2.     protected int x;
  3.     protected int y;
  4.  
  5.     public Punkt() {
  6.     }
  7.  
  8.     public Punkt(int x, int y) {
  9.         this.x = x;
  10.         this.y = y;
  11.     }
  12.  
  13.     public Punkt(Punkt p) {
  14.         this.x = p.x;
  15.         this.y = p.y;
  16.     }
  17.  
  18.     public int pobierzX() {
  19.         return this.x;
  20.     }
  21.  
  22.     public int pobierzY() {
  23.         return this.y;
  24.     }
  25.  
  26.     public Punkt pobierzPunkt() {
  27.         Punkt temp = new Punkt();
  28.         temp.ustawXY(this.x, this.y);
  29.         return temp;
  30.     }
  31.  
  32.     public void ustawX(int x) {
  33.         this.x = x;
  34.     }
  35.  
  36.     public void ustawY(int y) {
  37.         this.y = y;
  38.     }
  39.  
  40.     public void ustawXY(int wspX, int wspY) {
  41.         this.x = wspX;
  42.         this.y = wspY;
  43.     }
  44.  
  45.     public void ustawXY(Punkt pkt) {
  46.         this.x = pkt.x;
  47.         this.y = pkt.y;
  48.     }
  49.  
  50.     public void wyswietlWspolrzedne() {
  51.         System.out.println("(" + this.x + ", " + this.y + ")");
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement