/* finding the yellow area of an image. */ package shapes; import shapes.SSquare; import shapes.SCircle; import shapes.SRectangle; import java.lang.Math; public class YellowSpace { public static void main(String[] args) { double edge = 400; double d1 = 60; double d2 = 30; double d3 = 15; SSquare largegray = new SSquare(edge); double largegrayA = largegray.area(); System.out.println("largegray area = " + largegrayA); //finding the large yellow square SCircle largecircle = new SCircle((edge - (2 * d1)) / 2); SSquare largeyellow = largecircle.inscribingSquare(); double largeyellowA = largeyellow.area(); System.out.println("largeyellow area = " + largeyellowA); //finding the small gray square SCircle middlecircle = new SCircle((((Math.sqrt(largeyellowA)) / 2) - d2)); SSquare smallgray = middlecircle.inscribingSquare(); double smallgrayA = smallgray.area(); System.out.println("smallgray area = " + smallgrayA); // finding the small yellow square SCircle smallcircle = new SCircle((((Math.sqrt(smallgrayA)) / 2) - d3)); SSquare smallyellow = smallcircle.inscribingSquare(); double smallyellowA = smallyellow.area(); System.out.println("smallyellow area = " + smallyellowA); //finding the yellow space double yellowspace = ((largeyellowA - smallgrayA) + smallyellowA); System.out.println("yellow space area = " + yellowspace); } }