YellowSpace.java
1    package shapes;
2    
3    public class YellowSpace {
4        public static void main(String[] args) {
5            //measurements
6            double edgeLength = 80.0;
7            double tcToMidpoint = 8.0;
8            double dcToMidpoint2 = 4.0;
9    
10           //make tablecloth to think with
11           SSquare tableCloth = new SSquare(edgeLength);
12           //inscribing circle of table cloth
13           SCircle inscribingTc = tableCloth.inscribingCircle();
14           //shrink to make circumscribing circle of diamond
15           inscribingTc.shrink(tcToMidpoint);
16           //get inscribing square of the new circle
17           SSquare diamond = inscribingTc.inscribingSquare();
18           //get inscribing circle of diamond
19           SCircle inscribingD = diamond.inscribingCircle();
20           //shrink it to get circumscribing circle of gray square
21           inscribingD.shrink(dcToMidpoint2);
22           //get inscribing square of new circle (inner gray square)
23           SSquare innerGraySquare = inscribingD.inscribingSquare();
24   
25           //get the yellow area by subtracting are of diamond by are of inner gray square
26           double yellowArea = (diamond.area() - innerGraySquare.area());
27   
28           //Display result to output stream
29           System.out.println("The area of the yellow space on the tablecloth: " + yellowArea
30           + " square in");
31       }
32   }
33