Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part B: Link to files: https://drive.google.com/drive/folders/1j1z9xSn1NllJmk14H3ZGwkeRnK7oPZKz?usp=sharing Write a program that uses recursion to draw squares: one square on the corner of each square. You can
Part B:
Link to files: https://drive.google.com/drive/folders/1j1z9xSn1NllJmk14H3ZGwkeRnK7oPZKz?usp=sharing
Write a program that uses recursion to draw squares: one square on the corner of each square. You can write an applet, a standalone Swing GUI program, or a JavaFX program. Your choice! Note: I do not expect you to learn JavaFX for this lab! If you already know Swing, I recommend that you write the program in Swing. But I do want to give the option of using JavaFX for those who know JavaFX Requirements Your program should have instance data variables or constants that define . the initial size of the first (largest) square the minimum length of a size of a square by what factor you shrink the size for each round of squares Your program will include a recursive method to create/draw a square. The method should draw (applet/Swing) or create (JavaFX) only one square. o This is the small part of the problem it solves now The method should then recursively call itself to draw the four squares at the corner of the current square. o Thus, you will have four recursive calls inside the method. o For each recursive call, send in the new coordinates and size for each of the four corner squares o The size is reduced by some factor each time The recursive method should be initially invoked once from the paint method (for applets), paintComponent method (for Swing), or from the start method (for JavaFX) Consider: o What parameters should the recursive method have? o What initial values are sent into the first call to this method? o When does the method stop (what is the base case)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started