package com.lovecoding.day08.ex1;

public class Rectangle {

    private int length;
    private int weight;


    public double area(){
        return length * weight;
    }
    public double perimeter(){
        return (length + weight) * 2;
    }

    public String getInfo(){
        double area = this.area();
        return "矩形的长:"+length+"、宽："+weight+"、面积："+area+"、周长："+perimeter()+"信息";
    }

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        if (length <= 0){
            System.out.println("不能小于等于0");
        }else{
            this.length = length;
        }
    }

    public int getWeight() {
        return weight;
    }

    public void setWeight(int weight) {
        if (weight <= 0){
            System.out.println("不能小于等于0");
        }else{
            this.weight = weight;
        }

    }
}
