(b) Create a class named 'Rectangle' with two data members- length and breadth and a function to calculate the area whic

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

(b) Create a class named 'Rectangle' with two data members- length and breadth and a function to calculate the area whic

Post by answerhappygod »

B Create A Class Named Rectangle With Two Data Members Length And Breadth And A Function To Calculate The Area Whic 1
B Create A Class Named Rectangle With Two Data Members Length And Breadth And A Function To Calculate The Area Whic 1 (33.83 KiB) Viewed 54 times
(b) Create a class named 'Rectangle' with two data members- length and breadth and a function 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. Now, create objects of the 'Rectangle' class having none, one and two parameters and print their areas.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply