Rectangle Dimension Change(Rectangle.java)

 


public class Rectangle {
            
    private int length;
    private int width;public int getLength() {
        return length;
    }
    public void setLength(int length) {
        this.length = length;
    }
    public int getWidth() {
        return width;
    }
    public void setWidth(int width) {
        this.width = width;
    }
    public Rectangle(Integer length, Integer width)
    {
    this.setLength(length);
    this.setWidth(width);
    }
        public Integer area() {
    int area = length*width;
            return area;
    }



       public void display() {
    System.out.println("Rectangle Dimension");
    System.out.println("Length:"+length);
    System.out.println("Width:"+width);        
        }



       Rectangle dimensionChange(Integer newDimension) {
        int a=length*newDimension;
        int b=width*newDimension;
        Rectangle rectangleObject =new Rectangle(a,b);
            
            return rectangleObject;
        }



    }

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.