Question: Question 3: [Programming] Design a class named Rectangle that extends Geometricobject. The class contains: - Two double data fields named width, and length with default

 Question 3: [Programming] Design a class named Rectangle that extends Geometricobject.The class contains: - Two double data fields named width, and lengthwith default values 1.0 to denote two sides of the rectangle. -

Question 3: [Programming] Design a class named Rectangle that extends Geometricobject. The class contains: - Two double data fields named width, and length with default values 1.0 to denote two sides of the rectangle. - A constructor that creates a rectangle with the specified width, and length. - The get and set methods for all two data fields. - A method named getarea() that returns the area of this rectangle. - A method named getperimeter() that returns the perimeter of this rectangle. - A method named tostring() that returns a string description for the rectangle, as follows return"Rectangle:Width="+width+"length="+length; - Your code must be fully documented. This includes using Javadoc comments. - Use the following code as a startup for your solution. You only need to implement the Rectangle class. public class Assignment1 \{ public static void main(String[] args) \{ Rectangle rectangle = new Rectangle (1,1.5); rectangle.setColor ("yellow"); rectangle.setFilled(true); System.out.println(rectangle); System.out.println ("The area is " + rectangle.getArea()); System. out.println("The perimeter is " + rectangle.getPerimeter ()); System.out.println(rectangle); \} 3 public abstract class Geometricobject \{ private String color = "white"; private boolean filled; private java.util. Date dateCreated; / Construct a default geometric object */ protected Geometricobject() i dateCreated = new java.util. Date (); \} /** Construct a geometric object with color and filled value */ protected Geometricobject(String color, boolean filled) \{ dateCreated = new java.util. Date (); this.color = color; this.filled = filled; \}

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!