Question: Write a Java Program The purpose of this assignment is to practice recursion through writing a program that plots the Quadratic Koch Snowflake.Refer to our

Write a Java Program The purpose of this assignment is to practice recursion through writing a program that plots the Quadratic Koch Snowflake.Refer to our Programming Assignments FAQ for instructions on how to install VSCode, how to use the command line and how to submit your assignments.See this video on how to import the files into VS Code and how to submit into Autolab.OverviewThe Quadratic Koch Curve is an example of a fractal pattern like the H-tree pattern from Section 2.3 of the textbook.Your main task is to write a recursive function koch() that plots a Quadratic Koch Curve of order n to standard drawing.TaskWe provide a zip file (find it in Autolab) that contains QuadraticKoch.java.UPDATE and SUBMIT the corresponding file.ProgrammingCreate the Quadratic Koch Curve according to the following design specifications:USE StdDraw to draw the Koch Snowflake design. Refer to the Java file QuadraticKoch.java for specific information about the implementation. You only write in the QuadraticKoch.java file.You will write two helper functions getCoords() and koch() as well as the main() function.The StdDraw canvas size is 1\times 1 by default (and does not need to be changed).main() functionThe main function is the entry point of the program. This is the function that that Java Virtual Machine (JVM) calls to start execution.main() will read one command-line argument representing the order of the Quadratic Koch Curve to draw.then, it will call the koch()function 4 times. The coordinates of the four calls are shown below, starting with the bottom left vertex and moving in clockwise order.getCoords() is an iterative functionThis function computes and returns the set of coordinates to draw ONE segment of the Quadratic Koch Curve.Use a 2D array where the first row stores the x-coordinates and the second row stores the y-coordinates. The position of the coordinates matters when drawing the Quadratic Koch Curve.Note that x0, y0, x5, and y5 are provided as input parameters.Use the image below to visualize how to compute the additional coordinates (x1, y1),(x2, y2),(x3, y3), and (x4, y4).Hint: Think about how far x1 is away from x0 and how far x4 is away from x5. Use the same approach for the y values.koch() is a recursive functionThis function draws ONE segment of the Quadratic Koch Curve by recursively calling itself.The image below shows the recursive calls in color.koch()draws a line between the two points (x0, y0) and (x5, y5) using StdDraw.line()when order is zero (n ==0),otherwise it recursively calls koch() on the right adjacent coordinates as shown below, with the order being one less.
Write a Java Program The purpose of this

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!