1 package npw; 2 3 4 import painter.SPainter; 5 import shapes.SCircle; 6 import shapes.SSquare; 7 8 import java.awt.*; 9 import java.util.Scanner; 10 11 public class Invention1 { 12 13 public static void main(String[] args) { 14 15 SPainter painter = new SPainter("Invention1",600,600); 16 SCircle circle = new SCircle(100); 17 SSquare square = new SSquare(150); 18 painter.mbk(200); 19 20 int i = 0; 21 while (i < 5){ 22 painter.setColor(Color.blue); 23 painter.setBrushWidth(50); 24 painter.draw(circle); 25 painter.mfd(100); 26 i = i +1; 27 } 28 painter.moveToCenter(); 29 int x = 4; 30 while (x>0) { 31 if (x > 2) { 32 painter.mrt(100); 33 painter.mfd(100); 34 painter.setColor(Color.red); 35 painter.setBrushWidth(50); 36 painter.draw(square); 37 x = x - 1; 38 } else if (x == 2) { 39 painter.moveToCenter(); 40 painter.mfd(100); 41 painter.mlt(100); 42 painter.setBrushWidth(50); 43 painter.setColor(Color.green); 44 painter.draw(square); 45 x = x-1; 46 } else if (x == 1) { 47 painter.mfd(100); 48 painter.mlt(100); 49 painter.setBrushWidth(50); 50 painter.setColor(Color.green); 51 painter.draw(square); 52 x = x-1; 53 } 54 } 55 } 56 } 57