Question: PE1.java contains the following code: package ProgrammingExam1; import java.awt.Color; public class PE1 { public static void main(String[] args) { Draw blankCanvas = new Draw(Programmign Exam

PE1.java contains the following code:
package ProgrammingExam1;
import java.awt.Color;
public class PE1 {
public static void main(String[] args) {
Draw blankCanvas = new Draw("Programmign Exam 1");
blankCanvas.point(0.7, 0.7);
blankCanvas.circle(0.5, 0.5, 0.5);
blankCanvas.square(0.5, 0.5, 0.4);
blankCanvas.setPenColor(new Color(150, 150, 150));
blankCanvas.line(0.0, 0.5, 1, 0.5);
}
public static String nestedCircle (double x, double y, double radius, double diff, Draw page, String radiusList) {
// your code goes here. Task 1
return "";
}
public static String squares (double x, double y, double halfLength, int order, Draw page) {
// your code goes here. Task 2
return "";
}
public static ArrayList
// your code goes here. Task 3
return new ArrayList
}
}
class Point {
double x;
double y;
public Point(double x, double y) {
// your code goes here. Task 0
}
public static Point midpoint(Point p1, Point p2) {
// your code goes here. Task 0
return new Point(0, 0);
}
public String toString() {
return "["+this.x + ", "+ this.y +"]";
}
}
Task 2: For this task, you are required to implement a recursive method that draws a set of squares where the center of one square falls on one corner of another square. The number of squares that should be drawn is given as an input parameter called order. If the order is one, then only one square is drawn. If the order is two, then 5 squares will be drawn when on each corner of the central square another square is drawn, whose side length is half the central square's side length. Please see the picture below that shows the drawing for order = 1 to 4. The output of this method is a list of the coordinates of the smallest squares that are drawn. More information on this method can be found in the javaDoc. order = 1 order = 2 order = 3 order = 4 Sue placa co hoo. Plaa Sample Call: PE1.squares (0.5, 0.5, 0.2, 2, blankCanvas); Corresponding Output: [0.7, 0.7] [0.7, 0.3] [0.3, 0.7] [0.3, 0.3] Marking Scheme: [20 points]: For the correctness of the method. Please note that you will not receive any points if your function is not recursive. Also, make sure that you test your code thoroughly, as we have only provided a subset of the test cases by which Task 2: For this task, you are required to implement a recursive method that draws a set of squares where the center of one square falls on one corner of another square. The number of squares that should be drawn is given as an input parameter called order. If the order is one, then only one square is drawn. If the order is two, then 5 squares will be drawn when on each corner of the central square another square is drawn, whose side length is half the central square's side length. Please see the picture below that shows the drawing for order = 1 to 4. The output of this method is a list of the coordinates of the smallest squares that are drawn. More information on this method can be found in the javaDoc. order = 1 order = 2 order = 3 order = 4 Sue placa co hoo. Plaa Sample Call: PE1.squares (0.5, 0.5, 0.2, 2, blankCanvas); Corresponding Output: [0.7, 0.7] [0.7, 0.3] [0.3, 0.7] [0.3, 0.3] Marking Scheme: [20 points]: For the correctness of the method. Please note that you will not receive any points if your function is not recursive. Also, make sure that you test your code thoroughly, as we have only provided a subset of the test cases by which
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
