YellowSpace.java
1    /* 
2    A program to compute the area of the yellow space inside 2 grey squares. 
3     */
4    
5    package shapes;
6    
7    public class YellowSpace {
8    
9        public static void main(String[] args) {
10           //create the large gray square
11           double edgeLength = 400;
12           SSquare bigGreySquare = new SSquare(edgeLength);
13           SCircle circle1 = bigGreySquare.inscribingCircle();
14           double areaOfICircle1 = circle1.area();
15        //   System.out.println("Area of the big grey square: " + bigGreySquare.area());
16      //     System.out.println("Area of the imaginary inscribing circle inside the big grey square = " + areaOfICircle1);
17   
18   
19           //create the large yellow diamond
20           double distanceToBGS = 60;
21           SSquare bigYellowDiamond = new SSquare(distanceToBGS);
22           SCircle circle2 = bigYellowDiamond.inscribingCircle();
23           double areaOfCircle2 = circle2.area();
24        //   System.out.println("The area of the big yellow diamond: " + bigYellowDiamond.area());
25        //   System.out.println("The area of the imaginary inscribing circle inside the yellow diamond: " + areaOfCircle2);
26   
27   
28           //create the small grey square
29           double distanceToBYD = 30;
30           SSquare smallGreySquare = new SSquare(distanceToBYD);
31           SCircle circle3 = smallGreySquare.inscribingCircle();
32           double areaOfCircle3 = circle3.area();
33      //     System.out.println("The area of the small grey square: " + smallGreySquare.area());
34         //  System.out.println("The area the imaginary inscribing circle inside the small grey square: " + areaOfCircle3);
35   
36           //create the small yellow diamond
37           double distanceToSGS = 15;
38           SSquare smallYellowDiamond = new SSquare(distanceToSGS);
39           SCircle circle4 = smallYellowDiamond.inscribingCircle();
40           double areaOfCircle4 = circle4.area();
41       //    System.out.println("The area of the small yellow diamond: " + smallYellowDiamond.area());
42   //        System.out.println("The area of the imaginary inscribing circle inside the small yellow diamond: " + areaOfCircle4);
43   
44           System.out.println("The area of the yellow space:" + (bigYellowDiamond.area() - smallGreySquare.area() + smallYellowDiamond.area()));
45   
46   
47       }
48   }