Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task: In C++ design a base class 'Shape' and an inheriting class 'Polygon' Specifications: - Base class 'Shape' should have a 'color' string and two

Task: In C++ design a base class 'Shape' and an inheriting class 'Polygon'

Specifications:

- Base class 'Shape' should have a 'color' string and two virtual functions 'calculateArea' and 'calculatePerimeter' which can be applied to the appropriate type of polygon inheriting the class.

- Inheriting class 'Polygon' should have a string 'type' to specify the polygon and an int for number of sides. The type of polygon will be determined by the number of sides [ex) 3 = 'triangle'] and the appropriate virtual member functions from 'Shape' will be applied to each polygon. The sides can never be less than 3 or negative.

** In the main function demonstrate the classes work without any user input only constructors

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions

Question

Explain the process of MBO

Answered: 1 week ago