1 /* 2 * This program calculates the yellow space on a table cloth 3 */ 4 5 6 package shapes; 7 8 public class YellowSpace { 9 10 public static void main(String[] args){ 11 12 double yellowClothArea; 13 14 // Table cloth object 15 SSquare tableCloth = new SSquare(80); 16 17 // Creates an inscribing circle of table cloth object 18 SCircle inscribeTableCloth = tableCloth.inscribingCircle(); 19 20 // Creates circumscribing circle of yellow cloth based off of inscribing circle of table cloth 21 SCircle circumscribeYellowCloth = new SCircle(inscribeTableCloth.radius() - 8); 22 23 // Creates inscribing square based off of previous circumscribing circle 24 SSquare yellowCloth = circumscribeYellowCloth.inscribingSquare(); 25 26 // Creates inscribing circle of yellow cloth 27 SCircle inscribeYellowCloth = yellowCloth.inscribingCircle(); 28 29 // Creates circumscribing circle of black cloth based off of yellow inscribing circle 30 SCircle circumscribeBlackCloth = new SCircle(inscribeYellowCloth.radius() - 4); 31 32 // Creates black cloth based off of circumscribing circle 33 SSquare blackCloth = circumscribeBlackCloth.inscribingSquare(); 34 35 // Computes area of yellow cloth subtracted by black cloth 36 yellowClothArea = (yellowCloth.area() - blackCloth.area()); 37 38 // Displays result 39 System.out.println("Visible area of yellow cloth: " + yellowClothArea + " Units"); 40 41 } 42 43 } 44