Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write code for an applet that uses recursion to draw squares- one square on the

ID: 3563525 • Letter: W

Question

Write code for an applet that uses recursion to draw squares- one square on the corner of each square.

Include instance data that defines:

In the example, they use an initial side length of 200, a minimum side length of 10, and it cuts the size of a side in half each time. You do not have to use these values- experiment with your own. The example fills the square in gray and then draw the outline in black. This part isn't required.

The applet will include a method to draw a square. That method will include recursive calls to draw the four squares at the corner of the current square (the sides of these smaller squares are reduced by some factor). Stop when you attempt to draw a square whose length is less than the minimum you specified.

Here is a sample of what the output should look like:

Explanation / Answer

public static class LabC extends JLabel { public void paintRecursiveWraper(Graphics g, int minW, int minH, int x, int y, int w, int h) { g.drawRect(x, y, w, h); paintRecusive(g, minW, minH, x, y, w, h); } public void paintRecusive(Graphics g, int minW, int minH, int x, int y, int w, int h) { if (h
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote