/home/kchan2/NetBeansProjects/CS1/src/npw/Invention1.java
 1 /*
 2  * Program that:
 3  * uses at least one while statement and one if statement in a nontrivial way.
 4  * features both circles and squares, all created from just one circle and one square.
 5  * has no rectangles.
 6  * creates the exact same image every time it is run.
 7  */
 8 
 9 package npw;
10 
11 import shapes.SSquare;
12 import shapes.SCircle;
13 import painter.SPainter;
14 import java.awt.Color;
15 
16 /**
17  *
18  * @author kchan2
19  */
20 public class Invention1 {
21 
22     /**
23      * @param args the command line arguments
24      */
25     public static void main(String[] args) {
26         SPainter painter = new SPainter("Invention 1", 600, 600);
27         SSquare square = new SSquare(560);
28         SCircle circle = new SCircle(280);
29         painter.setBrushWidth(5);
30         painter.setColor(Color.BLUE);
31         paintTheImage(square, circle, painter);
32 
33     }
34 
35     private static void paintTheImage(SSquare square, SCircle circle, SPainter painter) {
36         double side = square.side();
37         while (side > 40) {
38             painter.draw(square);
39             painter.draw(circle);
40             square.s3();
41             square.x2();
42             circle.s3();
43             circle.x2();
44             side = square.side();
45             if (side < 200) {
46                 painter.setColor(Color.ORANGE);
47             }
48         }
49     }
50 
51 }
52