Invention2.java
package npw;

import java.awt.*;
import java.util.Random;

import painter.SPainter;
import shapes.SRectangle;

public class Invention2 {
    public static void main(String[] args){
        SPainter painter = new SPainter("Invention2", 1000, 500);
        int height = 500;
        int weight = 1000;
        SRectangle rectangle = new SRectangle(height, weight);
        int i = 1;
        while (true) {
            if (i < 100){
                painter.setColor(randomColor());
                painter.paint(rectangle);
                rectangle.setHeight((int) (rectangle.height()/1.1));
                rectangle.setWidth((int) (rectangle.width()/1.1));
                i = i + 1;
            }

        }
    }
    private static Color randomColor() {
        Random rgen = new Random();
        int r = rgen.nextInt(256);
        int g = rgen.nextInt(256);
        int b = rgen.nextInt(256);
        return new Color(r,g,b);
    }
}