Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

**If finished in the next 2 hours, i will double to point reward!!** This is the

ID: 3546971 • Letter: #

Question

**If finished in the next 2 hours, i will double to point reward!!**



This is the assignment:



This is what I have so far:




Write a class Square that has attributes: x and y - the coordinates of the center of the square halfSide - half of one side of the square color - for the color of the square The class should have a constructor that takes two coordinates and the halfSide; The class should also have the following methods: public void draw() - for drawing the square. (Used the method StdDraw.filledSquare) public void move(double newX, double newY) - that positions the square at the new coordinates (newX, newY) public voids scale(double percentage) - Scales the side of the square by the given percentage. public void setColor(Color newColor) - method that changes the color of the square. Write also a main method that creates an object of the class Square. Make the square move/animate in any way you like. Also, make the square blink by changing the color. In addition, scale the square randomly by generating a random value between 0.5 and 1.5 (or any values of your choice).

Explanation / Answer

public class Square { private int size; private int x; private int y; private Color color; private int a1, a2, a3; private static Random generator = new Random (); //---------------------------------------------- //A parameterless constructor that generates random values for the size, color, //x, and y. Make the size between 50 and 100, x between 0 and 300, y between 0 //and 300. The squares can be any color