YellowSpace.java
1    ///This program finds the area of yellow space in a picture with yellow and gray squares.
2    
3    
4    package shapes;
5    
6    public class YellowSpace {
7        public static void main(String[] args) {
8    
9    
10   
11           double edgelength = 400.0;
12           double distance = 60.0;
13   
14           ///First Circle
15   
16           SCircle largeyellowcircle = new SCircle((edgelength - (distance * 2.0)) / 2.0);             ///writes the circle that the square is inscribed in
17           System.out.println("largeyellowcirclearea =" + largeyellowcircle.area());
18   
19           SSquare largegraysquare = new SSquare(edgelength);
20   
21           System.out.println("large gray square area =" + largegraysquare.area());
22   
23           SSquare largeyellowdiamond = largeyellowcircle.inscribingSquare();
24           System.out.println("large yellow diamond area =" + largeyellowdiamond.area());
25   
26           ///Second Circle
27   
28           SCircle smallgraycircle = new SCircle(((edgelength - (distance + 30.0) * 2.0)) / 2.0);
29           System.out.println("smallgraycircle =" + smallgraycircle.area());
30   
31           SSquare smallgraysquare = smallgraycircle.inscribingSquare();
32           System.out.println("small gray square area =" + smallgraysquare.area());
33   
34           ///Third Circle
35   
36           SCircle smallyellowcircle = new SCircle(((edgelength - (distance + 45.0) * 2.0)) / 2.0);
37           System.out.println("small yellow circle area =" + smallyellowcircle.area());
38   
39           SSquare smallyellowdiamond = smallyellowcircle.inscribingSquare();
40           System.out.println("small yellow diamond area =" + smallyellowdiamond.area());
41   
42           System.out.println("The area of the yellow space =" + (largeyellowdiamond.area() - smallgraysquare.area()) + smallyellowdiamond.area());
43   
44       }
45   }
46   
47