Question: private boolean filled; private Date dateCreated; public Geometricobject ( ) { dateCreated = new Date ( ) ; } public GeometricObject ( String color, boolean

private boolean filled;
private Date dateCreated;
public Geometricobject()
{
dateCreated = new Date();
}
public GeometricObject(String color, boolean filled)
{
this.color = color; // "this" refers to the current object
this.filled = filled;
dateCreated = new Date();
}
public String getColor()
{
return color;
}
public void setColor(String color)
{
this.color = color;
}
public boolean getFilled()
{
return filled;
}
public void setFilled(boolean filled)
{
this.filled = filled;
}
public Date getDateCreated()
{
return dateCreated;
}
public String toString()
{
return "Created on: "+dateCreated+" Color: "+color+" Filled: "+filled;
}
}
Design a class named Triangle that extends Geometricobject.
The class contains:
i. Three double data fields named side1, side2, and side3 with default values 1.0 to
denote three sides of the triangle.
ii. A no-arg constructor that creates a default triangle.
iii. A constructor that creates a triangle with the specified side1, side2, and side3.
iv. The accessor methods for all three data fields.
v. A method named getArea() that returns the area of this triangle.
vi. A method named getPerimeter() that returns the perimeter of this triangle.
vii. A method named toString() that returns a string description with values of
three sides of the triangle.
Write a test program that prompts the user to enter three sides of the triangle, a color, and a boolean
value to indicate whether the triangle is filled. Create a Triangle object with these inputs. Display its
area, perimeter, color, and true or false to indicate whether it is filled or not
 private boolean filled; private Date dateCreated; public Geometricobject() { dateCreated =

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!