Create a class named 'Rectangle' with two data members- length and breadth and a method to claculate 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. Now, create objects of the 'Rectangle' class having none, one and two parameters and print their areas.
Answers
Answered by
0
Answer:
Design and then create a Rectangle class that has overloaded constructors. The first constructor requires no parameters. The second has two parameters, one for length and a second for width. Member variables store the length and width of the rectangle, and member methods assign and retrieve the length and width and return the area and perimeter of the rectangle. Test the class by writing appropriate client code.
This is a assignment given to me, and i cannot quite understand how to begin something like this, it is only part one of five and i would appreciate some help
Similar questions