YellowSpace.java
1    /* 
2     * This program will compute the area of the yellow space 
3     */
4    
5    package shapes;
6    
7    public class YellowSpace {
8        public static void main(String[] args) {
9            double edgeLength = 400;
10           double distance = 60;
11   
12           SSquare largeSquare = new SSquare(400);
13   
14   
15           /* Make a circle that circumscribes a diamond(square) with edge length - 2distance/2 radius. 
16           find the area of the large diamond. 
17            */
18   
19           SCircle aroundLargeDiamond = new SCircle(((edgeLength - ( 2 * distance)) * 0.5));
20           SSquare largeDiamond = aroundLargeDiamond.inscribingSquare();
21           double areaOfLargeDiamond = largeDiamond.area();
22   
23           /*Find the small square's area by using the side length of the large diamond and subtracting 60 from it 
24           * and then follow the same procedure*/
25   
26           SCircle aroundSmallSquare = new SCircle(((largeDiamond.side() - distance) * 0.5));
27           SSquare smallSquare = aroundSmallSquare.inscribingSquare();
28           double areaOfSmallSquare = smallSquare.area();
29   
30           /* Find the small diamond's area by using the side length of the small square and subtracting 30 from it 
31           and then follow the same procedure*/
32   
33           SCircle aroundSmallDiamond = new SCircle(((smallSquare.side() - (distance * 0.5) ) * 0.5));
34           SSquare smallDiamond = aroundSmallDiamond.inscribingSquare();
35           double areaOfSmallDiamond = smallDiamond.area();
36   
37           /*Total Area*/
38   
39           double areaOfYellow = ((areaOfLargeDiamond - areaOfSmallSquare) + areaOfSmallDiamond);
40           System.out.println("Area of the Yellow Space = " + areaOfYellow);
41   
42   
43   
44   
45   
46   
47       }
48   
49   }
50