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 and with default values and denote the width and
height of a rectangle.
A noarg constructor creates a default rectangle.
A constructor that creates a rectangle with the specified and
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:
A method named getArea that returns the area of this rectangle. o Area:
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 the
toString method must return:
Rectangle: width and height
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 and with default values and denote the width and
height of a rectangle.
A noarg constructor creates a default rectangle.
A constructor that creates a rectangle with the specified and
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:
A method named getArea that returns the area of this rectangle. o Area:
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 the
toString method must return:
Rectangle: width and height
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.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
