(Solved) : Observe Following Rules Use Systemexit Add Project Package Statements Change Class Name C Q41357771 . . .

Observe the following rules: DO NOT use System.exit). DO NOT add the project or package statements DO NOT change the class napublic class PolygonTrans form 1/ Returns a new array that is an exact copy of the given array. // The given array is not mutimage.pngWrite a two-dimensional transformation library by implementing the following API: public class PolygonTransform { / Returns aNote that the transformation methods scale(). translate) and rotate(O mutate the polygons. Here are some example test cases (Following these rules to be coded in Java using given:Observe the following rules: DO NOT use System.exit). DO NOT add the project or package statements DO NOT change the class name. DO NOT change the headers of ANY of the given methods. DO NOT add any new class fields. ONLY display the result as specified by the example for each problem. DO NOT print other messages, follow the examples for each problem. USE StdIn, StdOut, and StdDraw libraries public class PolygonTrans form 1/ Returns a new array that is an exact copy of the given array. // The given array is not mutated. public static doub le [l copy(doublell array) { // WRITE YOUR CODE HERE // Scales the given polygon by the factor alpha. public static void scale(double] x, double y, double alpha) //WRITE YOUR CODE HERE } // Translates the given polygon by (dx, dy). public static void translate(doublel x, doublel y, double dx, double dy) // WRITE YOUR CODE HERE } // Rotates the given polygon theta degrees counte rclockwise, about the origin. public static void rotate(double [] x, double] y, double theta) { I WRITE YOUR CODE HERE } // Tests each of the API methods by directly calling them. public static void main(String] args) { // WRITE YOUR CODE HERE } } 2 3 We were unable to transcribe this imageWrite a two-dimensional transformation library by implementing the following API: public class PolygonTransform { / Returns a new array object that is an exact copy of the given array. 1 The given array is not mutated. public static double [ ] copy(double [] array) // Scales the polygon by the factor alpha. public static void scale(double [ ] x, double[] y, double alpha) // Translates the polygon by (dx, dy) public static void translate (double [ ] x, double [ ] y, double dx, double dy) //Rotates the polygon theta degrees counterclockwise, about the origin. public static void rotate(double [ ] x, double [ ] y, double theta) // Tests each of the API methods by directly calling them. public static void main (String(] args) } Note that the transformation methods scale(). translate) and rotate(O mutate the polygons. Here are some example test cases (tests for copyO are not shown): // Scales polygon by the facto r 2 StdDraw.setScale (-5.0, +5.0 ); doublell x e, 1, 1, e doublell y e, , 2, 1 double alpha-2.0 StdDraw.setPenColor (StdD raw. RE I/ Rotates polygon 45 degrees. // Translates polygon by (2, 1 ). StdDraw.setScale (-5.0, +5.0); double] x 0, 1, 1, double y , 0, 2, 1 double dx 2.0, dy 1.0 StdDraw.setScale(-5.0, +5.0); doublell x 0, 1, 1, e ; doublell y e, e, 2, 1 double theta 45.0; StdDraw.setPenColor(StdDraw. RE StdDraw.setPenColor(StdDraw.RE D); D); D): StdDraw.polygon (x, y); scale(x, y, alpha); StdDraw.polygon(x, y); StdDraw. polygon (x, y) translate(x, y, dx, dy) StdDraw.setPenColor(StdDraw. BL rotate(x, y, theta); StdDraw.setPenColor(StdD raw. BL StdDraw.setPenColor(StdDraw. BL UE): UE): UE): StdDraw.polygon(x, y) StdDraw.polygon(x, y) StdDraw.polygon(x, y); (0, 0) (0, 0) (0, 0) Show transcribed image text Observe the following rules: DO NOT use System.exit). DO NOT add the project or package statements DO NOT change the class name. DO NOT change the headers of ANY of the given methods. DO NOT add any new class fields. ONLY display the result as specified by the example for each problem. DO NOT print other messages, follow the examples for each problem. USE StdIn, StdOut, and StdDraw libraries
public class PolygonTrans form 1/ Returns a new array that is an exact copy of the given array. // The given array is not mutated. public static doub le [l copy(doublell array) { // WRITE YOUR CODE HERE // Scales the given polygon by the factor alpha. public static void scale(double] x, double y, double alpha) //WRITE YOUR CODE HERE } // Translates the given polygon by (dx, dy). public static void translate(doublel x, doublel y, double dx, double dy) // WRITE YOUR CODE HERE } // Rotates the given polygon theta degrees counte rclockwise, about the origin. public static void rotate(double [] x, double] y, double theta) { I WRITE YOUR CODE HERE } // Tests each of the API methods by directly calling them. public static void main(String] args) { // WRITE YOUR CODE HERE } } 2 3

Write a two-dimensional transformation library by implementing the following API: public class PolygonTransform { / Returns a new array object that is an exact copy of the given array. 1 The given array is not mutated. public static double [ ] copy(double [] array) // Scales the polygon by the factor alpha. public static void scale(double [ ] x, double[] y, double alpha) // Translates the polygon by (dx, dy) public static void translate (double [ ] x, double [ ] y, double dx, double dy) //Rotates the polygon theta degrees counterclockwise, about the origin. public static void rotate(double [ ] x, double [ ] y, double theta) // Tests each of the API methods by directly calling them. public static void main (String(] args) }
Note that the transformation methods scale(). translate) and rotate(O mutate the polygons. Here are some example test cases (tests for copyO are not shown): // Scales polygon by the facto r 2 StdDraw.setScale (-5.0, +5.0 ); doublell x e, 1, 1, e doublell y e, , 2, 1 double alpha-2.0 StdDraw.setPenColor (StdD raw. RE I/ Rotates polygon 45 degrees. // Translates polygon by (2, 1 ). StdDraw.setScale (-5.0, +5.0); double] x 0, 1, 1, double y , 0, 2, 1 double dx 2.0, dy 1.0 StdDraw.setScale(-5.0, +5.0); doublell x 0, 1, 1, e ; doublell y e, e, 2, 1 double theta 45.0; StdDraw.setPenColor(StdDraw. RE StdDraw.setPenColor(StdDraw.RE D); D); D): StdDraw.polygon (x, y); scale(x, y, alpha); StdDraw.polygon(x, y); StdDraw. polygon (x, y) translate(x, y, dx, dy) StdDraw.setPenColor(StdDraw. BL rotate(x, y, theta); StdDraw.setPenColor(StdD raw. BL StdDraw.setPenColor(StdDraw. BL UE): UE): UE): StdDraw.polygon(x, y) StdDraw.polygon(x, y) StdDraw.polygon(x, y); (0, 0) (0, 0) (0, 0)

Expert Answer


Answer to Observe the following rules: DO NOT use System.exit). DO NOT add the project or package statements DO NOT change the cla…