Invention1.java
package npw;

import painter.SPainter;
import shapes.SCircle;
import shapes.SSquare;

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

public class Invention1 {
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                new Invention1();
            }
        });
    }
    public Invention1(){prep();}
    
    private void prep(){
        double radius = 50.0;
        double side = 100.0;

        SPainter brush = new SPainter("invention1", 800, 800);
        SCircle circle = new SCircle(radius);
        SSquare square = new SSquare(side);


        paintTheImage(brush, circle, square);
    }

    private void paintTheImage(SPainter brush, SCircle circle, SSquare square) {
        brush.setBrushWidth(1);
        brush.setColor(Color.black);
        double scale = circle.diameter();
        while (scale<500.0/*constraint: usually inequality form, sometimes, Boolean*/) {
            //rate of change
            scale = scale + square.diagonal();
            brush.mfd(scale-100);
            brush.tl();
            //a set of command you want to loop
            brush.draw(circle);
            brush.draw(square);

            if ( scale>=square.side()){

                brush.setColor(Color.ORANGE);
                brush.setBrushWidth((int) Math.log10(scale));

                //block of code to be excuted if the condition is true
            }

        }

    }

}