Question: Assignment: Your task is to write the 'Rectangle' class as prescribed below. The class should contain: Public double data fields named width and length; A
Assignment: Your task is to write the 'Rectangle' class as prescribed below. The class should contain:
Public double data fields named width and length;
A noargument constructor which sets both width and length to :
A second constructor that sets the values of width and length when creating a new object. Its signature should be Rectangle doubie newlidth, double newLength;
A setWidth function that assigns a new value to width. Its signature should be void setwidthdouble newhidth;
A setLength function that assigns a new value to length. lts signature should be void setwidthdouble newlength;
A getwidth function that returns the current value of width. Its signature should be double getWidth;
A getLength function that returns the current value of length. lts signature should be double getLength
A getArea function that returns the value of the area of the rectangle. Its signature should be double getarea;
IN C
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
