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 no-argument constructor which sets both width and length to 100:
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 setwidth(double newhidth);
A setLength function that assigns a new value to length. lts signature should be void setwidth(double 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();
1// IN C++
2q,
Assignment: Your task is to write the '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 Programming Questions!