Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package malben;
- public class malbin {
- private int haight;
- private int wideth;
- private int temp;
- private char s;
- public malbin ( int h ,int w){
- this(h,w,'*');
- }
- public malbin ( int h ,int w,char s){
- this.haight=h;
- this.wideth=w;
- this.s=s;
- }
- public malbin()
- {
- this(10,10);
- }
- public int getHaight() {
- return haight;
- }
- public void setHaight(int haight) {
- this.haight = haight;
- }
- public int getWideth() {
- return wideth;
- }
- public void setwideth(int wideth) {
- this.wideth = wideth;
- }
- public void show() {
- System.out.println("hekaf : "+(this.wideth*2+this.haight*2));
- System.out.println("area : "+this.wideth*this.haight);
- this.printMe(s);
- }
- public int getTemp() {
- return temp;
- }
- private void printMe(char siman)
- {
- for (int i=1;i<=this.haight;i+=1){
- for (int j=1;j<=this.wideth;j+=1){
- System.out.print(siman);
- }System.out.println();
- }
- }
- }
- /// main
- package malben;
- public class Tester {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- malbin a = new malbin(5,5) ;
- malbin b = new malbin(5,5,'8') ;
- a.show();
- b.show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement