Question: Rectangle -width: double // width not = length -length:double // width not = length -color:string - unit: string -Rectangle() [/default black 2 W3L cm -

 Rectangle -width: double // width not = length -length:double // width
not = length -color:string - unit: string -Rectangle() [/default black 2 W3L

Rectangle -width: double // width not = length -length:double // width not = length -color:string - unit: string -Rectangle() [/default black 2 W3L cm - Rectangle( width, length, color, unit) //full constructor -perimeter(): double // (width+length)2 -area(): double // width" length Setters and Gettters -toString() Create a class called Rectangle that includes the following object attributes and methods. Attributes All these class attributes must be private and hidden from the user's direct access. width of type double to represent the width of the rectangle. length of type double to represent the height of the rectangle. color of type String to represent the rectangle color unit of type String to represent the measurement units (eg. cm or meter, etc). the unit attribute must be declared final counter of type integer which counts the number of instantiated rectangle objects. Each time a new rectangle object is created the counter should be incremented. Constructors write the test class here Create a class called TestRectangle Test the creation for the following rectangle and print their relative information a default rectangle

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!