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

Java question. Could anyone please help me? Thank you so much. Prepare an abstra

ID: 3755276 • Letter: J

Question

Java question.

Could anyone please help me?

Thank you so much.

Prepare an abstract class called Shape for representing a general shape that can be drawn on the screen, using the following UML diagram as a guide. It should have a default constructor as well as a constructor that specifies a starting point for the shape, accessor and mutator methods for the colour of the shape, a mutator method for specifying a control point which determines the size of the shape, and an abstract draw method for drawing the shape based on the starting and control points #startPoint : Point #contro!Point : Point -colourColor +Shape C) Shape (startPoint Point) getColourO Color +setColour (colour Color)void +setControlPoint(controlPoint Point) void +drau(g: Graphics)void toString String

Explanation / Answer

import java.awt.*; import java.awt.Point; abstract class Shape { protected Point startPoint; protected Point controlPoint; private Color color; public Shape() { } public Shape(Point startPoint) { this.startPoint = startPoint; } public Color getColor() { return color; } public void setColor(Color color) { this.color = color; } public void setControlPoint(Point controlPoint) { this.controlPoint = controlPoint; } public abstract void draw(Graphics g); @Override public String toString() { return "Shape{" + "startPoint=" + startPoint + ", controlPoint=" + controlPoint + ", color=" + color + '}'; } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote