package Shapes; import exam1.DarkGreyArea; import expressions.ShapesThing; import painter.SPainter; import shapes.SCircle; import shapes.SSquare; import javax.swing.*; import java.awt.*; public class YellowSpace { //*main method call public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new YellowSpace(); } }); } //* setting which the class obj is gonna work and how for the main method public YellowSpace() {paintTheImage();} private void paintTheImage() { //*Encapsulate that action,...(how), and then describe in which sequence and details. SPainter canvas = new SPainter("YellowSpace",600,600); //* [Figuring] /******************************************************************************************************/ //* if the parameters are given in double, factor them to double. Use the factored variables. double edgelength = 400.0; double distance = 60.0; //*outer square SSquare largeGraySquare = new SSquare(edgelength); //*You may not create an inner square using .inscribingSquare, so set up the frame ... [flanking approach] SCircle frame1 = largeGraySquare.inscribingCircle(); frame1.shrink(distance); //*inner square (by inscribing sq, and it's orange.) SSquare largeYellowSquare = frame1.inscribingSquare(); //*it will automatically adjust the diagonal / side of the inner. (b/c related variable to the holder.) SCircle frame2 = largeYellowSquare.inscribingCircle(); frame2.shrink(distance/2.0); //*Creating more frames to make a pattern SSquare smallGreySquare = frame2.inscribingSquare(); //* the small grey square SCircle frame3 = smallGreySquare.inscribingCircle(); frame3.shrink(distance/4.0); //* keep going SSquare smallYellowSquare = frame3.inscribingSquare(); /******************************************************************************************************/ //*[Computation and labelling] double YellowArea = (largeYellowSquare.area() - smallGreySquare.area() + smallYellowSquare.area()); System.out.println("The Area of the Yellow Space = " + YellowArea); /******************************************************************************************************/ //Drawing canvas.setColor(Color.DARK_GRAY); canvas.paint(largeGraySquare); //* innersquare.ta(45) ... but Idk how to use .ta() ... [flanking] -> (painter).setHeading((double)); canvas.setColor(Color.ORANGE); canvas.setHeading(45.0); canvas.paint(largeYellowSquare); canvas.setColor(Color.DARK_GRAY); canvas.setHeading(90.0); canvas.paint(smallGreySquare); canvas.setColor(Color.ORANGE); canvas.setHeading(45.0); canvas.paint(smallYellowSquare); } } //*How to separate methods?