1 package shapes; 2 3 4 import shapes.SCircle; 5 import shapes.SSquare; 6 7 public class YellowSpace { 8 public static void main (String [] args){ 9 10 //dimensions of the tablecloth 11 double sideLength = 800.0; 12 double YellowSquareCorner =16.0; 13 double InteriorGraySquareCorner = 8.0; 14 15 16 //Create the objects using NPW 17 SSquare tableCloth = new SSquare(sideLength); 18 19 //Using the YellowSpace to create Circle. Subtract to find the diameter of the circle 20 double diamond = (sideLength - YellowSquareCorner); 21 double radius = (diamond/2); 22 23 //Create the circle 24 SCircle circle = new SCircle(radius); 25 26 //Now create the yellow diamond 27 SSquare YellowDiamond = circle.inscribingSquare(); 28 29 //Now find the circle for the gray square 30 SCircle circleForGraySquare = new SCircle((YellowDiamond.side() - InteriorGraySquareCorner)/2); 31 32 SSquare interiorGraySquare = circleForGraySquare.inscribingSquare(); 33 34 35 //Now find the yellow space 36 double yellowSpace = (tableCloth.area()-interiorGraySquare.area()); 37 38 System.out.println("Yellow Space = " + yellowSpace); 39 40 41 } 42 43 44 } 45 46 47 48 49 50