Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

In C++ please #include #include using namespace std; /** * defining class circle */ class Circle { //defining public variables public: double pi; double radius;

In C++ please

#include  #include  using namespace std; /** * defining class circle */ class Circle { //defining public variables public: double pi; double radius; public: //default constructor to initialise variables Circle(){ pi = 3.14159; radius = 0; } Circle(double r){ pi = 3.14159; radius = r; } // defining getter and setters void setRadius(double r){ radius = r; } double getRadius(){ return radius; } // method to get Area double getArea(){ return pi*radius*radius; } }; //main method int main() { //declaring and taking input of radius double r; cout<<"Enter radius: "; cin>>r; //making an object of class circle Circle c(r); //printing area of circle cout<<"Area = "< 

Write a statement that defines an array of five objects of the Circle class in the above source code. Let the default constructor execute for each element of the array.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions