Question: import java.util.Random; import java.util.Scanner; public class Question2 { public static void drawPolygon(Turtle turtle, int numSides, int sideLength) { // complete } public static void drawPolygon(Turtle
import java.util.Random;
import java.util.Scanner;
public class Question2 {
public static void drawPolygon(Turtle turtle, int numSides, int sideLength) {
// complete
}
public static void drawPolygon(Turtle turtle, int numSides, double radius) {
}
public static void drawStarBurst(Turtle turtle, int numBursts, int radius) {
// complete
}
public static void conchSpiral( Turtle turtle, int numSides, double sRad, double eRad,
int numSteps, int stepAngle) {
// complete
}
public static void floralSpiral(Turtle turtle, int numSides, double sRad, double eRad,
int numSteps, double stepAngle) {
}
public static void main(String[] args)
{
Turtle bob = new Turtle();
// statements to control bob here and invoke methods here
}
}




uestion02 (drawing with iterative loops In Question02, you will write methods that create graphical elements using iteration (the repetition of statements using loops, such as for or while loops) a) Create a method drawPolygon (Turtle turtle, int sideLength, int numSides) that will draw a regular polygon with numSides sides (i.e. a polygon where all numSides sides are of equal length given by the argument sideLength) You should be able to see from Question01, that there is a pattern in drawing both the equilateral triangle and the square. In this method, you should use a loop (e.g FOR loop) in order to instruct the turtle to draw the polygon. The recipe (algorithm) for drawing a polygon is summarized in Fig.3. Note that the POLYGON algorithm shows a recipe for drawing a polygon with N sides, each of length 1. The angles between each of the sides is thus 2t/N (radians), which is equivalent to (360/N degrees). If heading clockwise, the turn should be to the right within each repetition. uestion02 (drawing with iterative loops In Question02, you will write methods that create graphical elements using iteration (the repetition of statements using loops, such as for or while loops) a) Create a method drawPolygon (Turtle turtle, int sideLength, int numSides) that will draw a regular polygon with numSides sides (i.e. a polygon where all numSides sides are of equal length given by the argument sideLength) You should be able to see from Question01, that there is a pattern in drawing both the equilateral triangle and the square. In this method, you should use a loop (e.g FOR loop) in order to instruct the turtle to draw the polygon. The recipe (algorithm) for drawing a polygon is summarized in Fig.3. Note that the POLYGON algorithm shows a recipe for drawing a polygon with N sides, each of length 1. The angles between each of the sides is thus 2t/N (radians), which is equivalent to (360/N degrees). If heading clockwise, the turn should be to the right within each repetition
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
