/**
 * A class representing a rectangle
 */
public class Rectangle {
    private int width;
    private int height;

    public Rectangle(int width, int height) {
        this.setWidth(width);
        this.setHeight(height);
    }

    public int getWidth() {
        return this.width;
    }

    public void setWidth(int newWidth) {
        if (newWidth <= 0) {
            throw new IllegalArgumentException("width must be > 0");
        }
        this.width = newWidth;
    }

    public int getHeight() {
        return this.height;
    }

    public void setHeight(int newHeight) {
        if (newHeight <= 0) {
            throw new IllegalArgumentException("height must be > 0");
        }
        this.height = newHeight;
    }

    @Override
    public String toString() {
        return String.format("Rectangle(%d, %d)", width, height);
    }
}
