Computer Science, asked by rohitahanthem2163, 8 months ago

Create a class named 'Rectangle' with two data members- length and breadth and a method to calculate the area which is 'length*breadth'. The class has three constructors which are:
1 - having no parameter - values of both length and breadth are assigned zero.
2 - having two numbers as parameters - the two numbers are assigned as length and breadth respectively.
3 - having one number as parameter - both length and breadth are assigned that number.
Also, provide set and get functions for the length and width attributes. The set functions should verify that length and width are each floating-point numbers larger than 0.0 and less than 20.0.
Now, create objects of the 'Rectangle' class having none, one and two parameters and print their areas.

Answers

Answered by himanggarg
0

DO YOUR HOMEWORK YOURSELF

Similar questions