Advertisement
Guest User

Punkt.java

a guest
Nov 13th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1.  
  2. public class Punkt {
  3.     public int x, y;
  4.     //private int x, y;
  5.    
  6.     //konstruktor
  7.  
  8.     Punkt(){
  9.         x = 0;
  10.         y = 0;
  11.     }
  12.    
  13.     Punkt(int a, int b){
  14.         x = a;
  15.         y = b;
  16.     }
  17.    
  18.     void wyswietl() {
  19.         System.out.println(x + ", " + y);
  20.     }
  21.     int getx() {
  22.         return x;
  23.     }
  24.     int gety() {
  25.         return y;
  26.     }
  27.     void setxy(int nowyx, int nowyy) {
  28.         x = nowyx;
  29.         y = nowyy;
  30.     }
  31.     void ustawxy(Punkt nowy) {
  32.         x = nowy.x;
  33.         y = nowy.y;
  34.     }
  35.     Punkt pobierzWsp() {
  36.         Punkt nowy = new Punkt();
  37.         nowy.x = x;
  38.         nowy.y = y;
  39.         return nowy;
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement