The Question is below, and at the bottom is what the output needs to be.
Please pay attention to getting the exact output that it is asking for.
Design a class named Triangle that extends GeometricObject:
import java.util.Scanner;
abstractclass GeometricObject {
privateString color = "white";
privateboolean filled;
private java.util.Date dateCreated;
/**Construct adefault geometricobject */
protected GeometricObject() {
}
/**Construct a geometricobject with color and filledvalue */
protected GeometricObject(String color,boolean filled) {
dateCreated = new java.util.Date();
this.color = color;
this.filled = filled;
}
/** Return color */
publicString getColor() {
return color;
}
/** Set a new color */
public void setColor(String color) {
this.color = color;
}
/** Return filled. Since filled isboolean ,
* the getmethod isnamed isFilled */
publicboolean isFilled() {
return filled;
}
/** Set a new filled */
public void setFilled(boolean filled) {
this.filled = filled;
}
/** Get dateCreated */
public java.util.Date getDateCreated() {
return dateCreated;
}
@Override
publicString toString() {
return "created on " + dateCreated + "ncolor: " + color +
" and filled: " + filled;
}
/** Abstractmethod getArea */
public abstractdouble getArea();
/** Abstractmethod getPerimeter */
public abstractdouble getPerimeter();
}
The Triangleclass contains:
Threedouble data fieldsnamed side1, side2, and side3
Adefault constructor that creates a triangle with three sides of length 1.0
Aconstructor that creates a triangle with specifiedvalues for side1, side2, and side3
Accessormethods for all three data fields
Amethod called getArea() that returns the area of a triangle
Amethodnamed getPerimeter() that returns the perimeter of the triangle
Amethodnamed toString() that returns thestring description of the triangle in the following format: "Triangle: side1 = " + side1 + " side2 = " + side2 + " side3 = " + side3;
Test your Triangleclass in a Driveprogram (in the same file) that prompts the user to enter the three sides of the triangle, the color, andwhether or not the triangle is filled. Theprogram should create a Triangleobject with these sides and set the color and filled properties. Then, it should display the area, perimeter, color, and filledvalue .
SAMPLE RUN #1: java Driver Interactive Session Standard Input Standard Error (empty) Standard Output Hide InvisiblesHighlight: NoneStandard Input OnlyPrompts OnlyStandard Output w/o PromptsFull Standard OutputAllShow Highlighted Only
THIS IS THE OUTPUT NEEDED BELOW
Enter·side·1·of·triangle:3↵
Enter·side·2·of·triangle:4↵
Enter·side·3·of·triangle:5↵
Enter·color·of·triangle:purple↵
Enter·whether·triangle·is·filled·(yes/no):no↵
Area:·6.0
Perimeter:·12.0
Color:·purple
Filled?:·false