Define a pure abstract base class called BasicShape . The BasicShape class should have the following members:   Private Member Variable: area, type double used to hold the shape's area. Public Member Functions: setArea: assigns received argument to area variable. getArea. This function should return the value in the member variable area. calcArea. This function should be a pure virtual function.   Next, define a class named Circle . It should be derived from the BasicShape class. It should have the following members: Private Member Variables: centerX, type integer used to hold the x coordinate of the circle’s center. centerY, type integer used to hold the y coordinate of the circle’s center. radius, type double used to hold the circle's radius. Public Member Functions: constructor—accepts values for centerX, centerY, and radius. Should also call the overridden calcArea function described below. getCenterX—returns the value in centerX. getCenterY—returns the value in centerY. calcArea—calculates the area of the circle (area = 3.14159 * radius * radius) and stores the result in the inherited member variable area in base class.   Next, define a class named Rectangle. It should be derived from the BasicShape class. It should have the following members: Private Member Variables: width, type double used to hold the width of the rectangle. length, type double used to hold the length of the rectangle. Public Member Functions: constructor—accepts values for width and length. Should also call the overridden calcArea function described below. getWidth—returns the value in width. getLength—returns the value in length. calcArea—calculates the area of the rectangle (area = length * width) and stores the result in the inherited member variable area in base class.   Write a main function that will declare pointer array of type BasicShape having size 4 and initialize the array with the objects of type circle, circle, rectangle and rectangle respectively. Then using for loop, display the area of those shapes (circle and rectangle) whose area > 100 .   Note: Do not change the names of functions and variables. Otherwise, marks will be deducted. Do not define extra functions

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

plz do it urgent in devc++. and plzz dont reject it

 

Define a pure abstract base class called BasicShape . The BasicShape class should have the following members:

 

Private Member Variable:

area, type double used to hold the shape's area.

Public Member Functions:

setArea: assigns received argument to area variable.

getArea. This function should return the value in the member variable area.

calcArea. This function should be a pure virtual function.

 

Next, define a class named Circle . It should be derived from the BasicShape class. It should have the following members:

Private Member Variables:

centerX, type integer used to hold the x coordinate of the circle’s center.

centerY, type integer used to hold the y coordinate of the circle’s center.

radius, type double used to hold the circle's radius.

Public Member Functions:

constructor—accepts values for centerX, centerY, and radius. Should also call the overridden calcArea function described below.

getCenterX—returns the value in centerX.

getCenterY—returns the value in centerY.

calcArea—calculates the area of the circle (area = 3.14159 * radius * radius) and stores the result in the inherited member variable area in base class.

 

Next, define a class named Rectangle. It should be derived from the BasicShape class. It should have the following members:

Private Member Variables:

width, type double used to hold the width of the rectangle.

length, type double used to hold the length of the rectangle.

Public Member Functions:

constructor—accepts values for width and length. Should also call the overridden calcArea function described below.

getWidth—returns the value in width.

getLength—returns the value in length.

calcArea—calculates the area of the rectangle (area = length * width) and stores the result in the inherited member variable area in base class.

 

Write a main function that will declare pointer array of type BasicShape having size 4 and initialize the array with the objects of type circle, circle, rectangle and rectangle respectively. Then using for loop, display the area of those shapes (circle and rectangle) whose area > 100 .

 

Note: Do not change the names of functions and variables. Otherwise, marks will be deducted. Do not define extra functions

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education