Question: You must keep the class nameYou must keep the class name You must hold the naming conventions requested in this document All deliverables are defined

You must keep the class nameYou must keep the class name
You must hold the naming conventions requested in this document
All deliverables are defined at the end of this document. You must upload them as requested.
(Class Name: Rectangle, Java File Name: Rectangle.java) Design and write a Rectangle class that
extends the GeometricShape class provided in the midterm test on Blackboard. The class
contains:
Two double data fields called w and h with default values 3.0, and 4.0 denote the width and
height of a rectangle.
A no-arg constructor creates a default rectangle.
A constructor that creates a rectangle with the specified w and h.
The accessor (getter) methods for both data fields.
The mutator (setter) methods for both data fields.
A method named getPerimeter() that returns the perimeter of this rectangle. o Perimeter:
p=2**(w+h)
A method named getArea() that returns the area of this rectangle. o Area: a=w**h
A method named toString() that returns a string description for the rectangle.
o For example, if we have a rectangle with the following width and height (3.0,4.0), the
toString() method must return:
Rectangle: width =3.0 and height =4.0
In the main method, write a testing program that prompts the user to enter the width and
height of the rectangle, a colour, and a boolean value to indicate whether the rectangle is filled.
The program should create a Rectangle object with the specified width and height and set the
colour and filled properties using the input. The program should display the area, perimeter,
colour, and true or false to indicate whether it is filled or not.
You must hold the naming conventions requested in this document
All deliverables are defined at the end of this document. You must upload them as requested.
(Class Name: Rectangle, Java File Name: Rectangle.java) Design and write a Rectangle class that
extends the GeometricShape class provided in the midterm test on Blackboard. The class
contains:
Two double data fields called w and h with default values 3.0, and 4.0 denote the width and
height of a rectangle.
A no-arg constructor creates a default rectangle.
A constructor that creates a rectangle with the specified w and h.
The accessor (getter) methods for both data fields.
The mutator (setter) methods for both data fields.
A method named getPerimeter() that returns the perimeter of this rectangle. o Perimeter:
p=2**(w+h)
A method named getArea() that returns the area of this rectangle. o Area: a=w**h
A method named toString() that returns a string description for the rectangle.
o For example, if we have a rectangle with the following width and height (3.0,4.0), the
toString() method must return:
Rectangle: width =3.0 and height =4.0
In the main method, write a testing program that prompts the user to enter the width and
height of the rectangle, a colour, and a boolean value to indicate whether the rectangle is filled.
The program should create a Rectangle object with the specified width and height and set the
colour and filled properties using the input. The program should display the area, perimeter,
colour, and true or false to indicate whether it is filled or not.
 You must keep the class nameYou must keep the class name

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!