Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q1- Write a C++ program that has following class diagram: Shape +printArea(): virtual void +printCircumference(): virtual void Triangle Circle Rectangle -base: int -radius: int -breadth:

image text in transcribed

Q1- Write a C++ program that has following class diagram: Shape +printArea(): virtual void +printCircumference(): virtual void Triangle Circle Rectangle -base: int -radius: int -breadth: int -height: int +printArea():void +printCircumference():void -hypo: int -length: int +printArea():void +printCircumference():void +printArea():void +printCircumference():void You should implement setters and getters for all the variables of each class as well as defined variables and functions above. Shape class is the abstract parent class and triangle, circle and rectangle classes are inherited from the parent class. It is required Program needs to find the area and circumferences of shapes. Also, you need to create a method: int CalculateTotalArea (Shape **shapes). This method needs to calculate total area of each shapes created. Thanks to usage of polymorphism and abstract class, you may send any object from the child class of Shape class as a parameter to the function. Sample Output: ------ Enter how many rectangles you want to create: 2 Enter how many circles you want to create: 1 Enter how many triangles you want to create: 2 ---Rectangles-- Enter breadth and length respectively: 36 Enter breadth and length respectively: 4 5 Total Area of Rectangles: 38.0 ------ Triangles--- Enter base and height and hypo respectively: 6 8 10 Enter base and height and hypo respectively: 7 24 25 Total Area of Triangles: 216.0 ------Circles-- Enter radius: 4 Total Area of Circles: 50.24

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

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions