Xetos

Prog 05 teglalap

Mar 3rd, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1.  
  2. public class Teglalp {
  3.     private int x;
  4.     private int y;
  5.     public int getX() {
  6.         return x;
  7.     }
  8.     public void setX(int x) {
  9.         this.x = x;
  10.     }
  11.     public int getY() {
  12.         return y;
  13.     }
  14.     public void setY(int y) {
  15.         this.y = y;
  16.     }
  17.    
  18.     public Teglalp(){
  19.         x=10;
  20.         y=15;
  21.     }
  22.     public Teglalap(int x, int y){
  23.         this.x = x;
  24.         this.y = y;
  25.     }
  26.     // Spec teglalap: negyzet
  27.     public Teglalap(int negyzetoldal)
  28.     {
  29.         x = negyzetoldal;
  30.         y = negyzetoldal;
  31.        
  32.     }
  33.    
  34.     public int kerulet(int a, int b){
  35.         return 2*(a+b);
  36.     }
  37.     public int terulet(int a, int b){
  38.         return a*b;
  39.     }
  40.    
  41.    
  42.    
  43. }
Add Comment
Please, Sign In to add comment