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 Htree pattern from Section 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 times by default and does not need to be changedmain 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 commandline argument representing the order of the Quadratic Koch Curve to draw.then, it will call the kochfunction 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 D array where the first row stores the xcoordinates and the second row stores the ycoordinates. The position of the coordinates matters when drawing the Quadratic Koch Curve.Note that x y x and y are provided as input parameters.Use the image below to visualize how to compute the additional coordinates x yx yx y and x yHint: Think about how far x is away from x and how far x is away from x 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.kochdraws a line between the two points x y and x y using StdDraw.linewhen order is zero n otherwise it recursively calls koch on the right adjacent coordinates as shown below, with the order being one less.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
