YellowSpace.java
1    package shapes;
2    
3    import shapes.SCircle;
4    import shapes.SSquare;
5    
6    public class YellowSpace {
7    
8        public static void main(String [] args) {
9    
10           int lrgGreySquareSideLength = 400;
11           int circleStartingRadius = (lrgGreySquareSideLength / 2);
12   
13           //Large grey square
14           SCircle circle = new SCircle(circleStartingRadius);
15           SSquare lrgGreySquare = circle.inscribingSquare();
16   
17           //Large yellow diamond
18           circle.shrink(60);
19           SSquare lrgYellowDiamond = circle.inscribingSquare();
20   
21           //Small grey square
22           circle.shrink(30);
23           SSquare smallGreySquare = circle.inscribingSquare();
24   
25           //Small yellow diamond
26           circle.shrink(15);
27           SSquare smallYellowDiamond = circle.inscribingSquare();
28   
29           //Yellow areas
30           double lrgYellowDiamondArea = lrgYellowDiamond.area();
31           double smallYellowDiamondArea = smallYellowDiamond.area();
32           double yellowArea = (lrgYellowDiamondArea + smallYellowDiamondArea);
33   
34           //Grey areas
35           double smallGreySquareArea = smallGreySquare.area();
36           double greyArea = (smallGreySquareArea);
37   
38           //Grey area subtracted from the yellow area
39           double areaOfYellow = (yellowArea - greyArea);
40           System.out.println("Yellow space area = " + areaOfYellow);
41   
42   
43   
44   
45       }
46   }
47