6:20 el LTE 4 Module 09 Graded Problem Task 4 Module 09 Graded Problem Set due May 11, 2022 23:59 HKT Bookmark this page Description In this exercise, you are tasked to modify the recursive method, drawFractalTree(), in the TreePanel class so that a fractal tree with four branches at each node will be drawn. Project Template The project template for this graded task can be downloaded here. Instructions 1. The run the program, create a new instance traTree
LTE ES 6:20 1. The run the program, create a new instance of FractalTree. 2. The current implementation of the drawFractalTree() method draws the tree with three branches at each node oriented at 20 degrees, O degrees and -20 degrees relative to the node by three recursive calls. 3. Modify the implementation of the method so that it draws the tree with four branches at each node orientated at 30 degrees, 15 degrees, -15 degrees and -30 degrees relative to the node by four recursive calls. 4. You will need to change the fourth parameter for each of the four recursive calls to the drawFractalTree() method to complete this task. 5. Submit ONLY the codes for the recursive calls. The remaining codes given in the drawFractalTree() method must
l UE 6:20 drawFractalTree() method must not be submitted. Sample Output Submission The implementation of the method for drawing three branches at each node is already given. You will need to modify the code to draw four branches at each node and submit only the code for making the four recursive calls in the MODULE 09 GRADED PROBLEM TASK 4 textbox below. private void drawFractalTree (Graphics g, int x1, int yi, double angie, int level) {
LTE E 6:20 private void drawFractat ree(Graphics g, int x1, int yı, double angle, int level) { // stopping condition if (level <= 0) return; // calculate the location of the next node int x2 = x1 + (int) (Math.cos(Math.toRadians (angle)) = level * maxlength); int y2 = y1 + (int) (Math.sin(Math.toRadians (angle)) * level * maxlength); // set the color for drawing in the current branch setLineColor(g. level); // draw the current branch 9.drawLine(x1, yi, x2, y2); // code before this line must not be submitted // draw the tree in different orientations by recursive calls drawFractalTree(g, x2, yz, angle - 20, level - 1); drawFractalTreelg, x2, y2, angle, level - 1); drawFractalTreelg, x2, y2, angle + 20, level - 1); }
6:20 LTE E - 20, level - 1); drawFractalTree(g, x2, y2, angle, level - 1); drawFractalTree(g, x2, y2, angle + 20, level - 1); } Module 09 Graded Problem Task 4 0.0/1.0 point (graded) 1// draw the tree in different orientation 2 Press ESC then TAB or click outside of the code editor to exit Unanswered Save
6:20 el LTE 4 Module 09 Graded Problem Task 4 Module 09 Graded Problem Set due May 11, 2022 23:59 HKT Bookmark this page
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
6:20 el LTE 4 Module 09 Graded Problem Task 4 Module 09 Graded Problem Set due May 11, 2022 23:59 HKT Bookmark this page
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!