Advertisement
Guest User

mda

a guest
Jan 17th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.20 KB | None | 0 0
  1. package malben;
  2.  
  3. public class malbin {
  4.     private int haight;
  5.     private int wideth;
  6.     private int temp;
  7.     private char s;
  8.    
  9.     public malbin ( int h ,int w){
  10.         this(h,w,'*');
  11.     }
  12.     public malbin ( int h ,int w,char s){
  13.         this.haight=h;
  14.         this.wideth=w;
  15.         this.s=s;
  16.     }
  17.    
  18.     public malbin()
  19.     {
  20.         this(10,10);
  21.     }
  22.  
  23.     public int getHaight() {
  24.         return haight;
  25.     }
  26.  
  27.     public void setHaight(int haight) {
  28.         this.haight = haight;
  29.     }
  30.  
  31.     public int getWideth() {
  32.         return wideth;
  33.     }
  34.  
  35.     public void setwideth(int wideth) {
  36.         this.wideth = wideth;
  37.     }
  38.  
  39.     public void show() {
  40.         System.out.println("hekaf :  "+(this.wideth*2+this.haight*2));
  41.         System.out.println("area : "+this.wideth*this.haight);
  42.         this.printMe(s);
  43.        
  44.     }
  45.  
  46.     public int getTemp() {
  47.         return temp;
  48.     }
  49.    
  50.     private void printMe(char siman)
  51.     {
  52.         for (int i=1;i<=this.haight;i+=1){
  53.             for (int j=1;j<=this.wideth;j+=1){
  54.                 System.out.print(siman);
  55.                 }System.out.println();
  56.         }
  57.     }
  58.  
  59. }
  60. /// main
  61. package malben;
  62.  
  63. public class Tester {
  64.  
  65.     public static void main(String[] args) {
  66.         // TODO Auto-generated method stub
  67.         malbin a = new malbin(5,5) ;
  68.         malbin b = new malbin(5,5,'8') ;
  69.        
  70.        
  71.         a.show();
  72.         b.show();
  73.     }
  74.  
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement