Question: Make a Rectangle class containing define a constant which can be used as a default value for the length and width variables of the class
Make a Rectangle class containing
define a constant which can be used as a default value for the length and width variables of the class
declare length and width data members with private keyword
define a default constructor
define a constructor with two arguments
define a setLength method
define a setWidth method
define a setLengthWidth method it will set both private variables of class at the same time
define a getLength method
define a getWidth method
findArea
findPerimeter
define a toString method overriding toString method of Object class
define an equals method overriding equals method of Object class
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
