Design a class Parallelogram that contains two private data members: - double length, - double height. Parallelogram class should also have following public methods: - parameterized constructor, - a...


Design a class Parallelogram that contains two private data members:




  • -  double length,




  • -  double height.


    Parallelogram class should also have following public methods:






  • -  parameterized constructor,




  • -  a method to calculate area of parallelogram.


    Design another class Rectangle that inherits from Parallelogram (since a Rectangle is-a Parallelogram). Class Rectangle should have the following public members:






  • -  parameterized constructor,




  • -  a method to calculate perimeter,




  • -  a method to tell if the Rectangle object is a Square.


    Develop the main function to fully test these two classes.




Note:


1. please use multiple files (separate compilation)

2. length and height should be protected members in the base class, as you need them to calculate perimeter of a rectangle.



Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here