1 /* 2 * Program to use circles to create 4 squares, some of them turned to be diamonds, all with relation to 3 * each other through edgelength and mid point. There are 2 yellow squares for which the area must be 4 * calculated. 5 */ 6 7 package shapes; 8 9 public class YellowSpace { 10 public static void main(String[] args){ 11 //create the large square and variable edgelength(400mm) for the large gray square 12 double edgelength = 400.0; 13 SSquare largegraySquare = new SSquare(edgelength); 14 //create a circle by inscribing the largegray square and shrink it's radius by the midpoint 15 //measurement(60mm). 16 SCircle largegrayCircle = largegraySquare.inscribingCircle(); 17 double midpoint = 60.0; 18 largegrayCircle.shrink(midpoint); 19 SSquare largeyellowDiamond = largegrayCircle.inscribingSquare(); 20 //print the area of the large yellow diamond 21 System.out.println("The area of the large yellow diamond is " + largeyellowDiamond.area() + "mm squared"); 22 //create an inscribing circle of the large yellow diamond, and shrink it by 30mm, 23 //which is midpoint/2 and create the small gray square 24 SCircle largeyellowCircle = largeyellowDiamond.inscribingCircle(); 25 largeyellowCircle.shrink(midpoint/2); 26 SSquare smallgraySquare = largeyellowCircle.inscribingSquare(); 27 //print the area of the small gray square 28 System.out.println("The area of the small gray square is " + smallgraySquare.area() + "mm squared"); 29 //create the small yellow circle by inscribing the small gray square and shrink it 30 //by 15mm, which is midpoint/4 31 SCircle smallyellowCircle = smallgraySquare.inscribingCircle(); 32 smallyellowCircle.shrink(midpoint/4); 33 //create the small yellow diamond and print it's area 34 SSquare smallyellowDiamond = smallyellowCircle.inscribingSquare(); 35 System.out.println("The area of the small yellow diamond is " + smallyellowDiamond.area() + "mm squared"); 36 //calculate the yellow area-->larege yellow diamond + small yellow diamond - small gray square 37 //print the yellow area 38 double Tyellowarea = (smallyellowDiamond.area() + largeyellowDiamond.area()) - smallgraySquare.area(); 39 System.out.println("The total yellow area of the shapes is " + Tyellowarea + "mm squared"); 40 41 } 42 } 43