Two additional data members (integers) to store the x and y coordinate of the center of the Circle. A parameterized constructor. Set() and Get() methods for each of the data member. A function to display the data members of the class. A function enlargeCirlce(int); which increases the radius of the circle by the factor passed as input to the For example, if “c” is an object of class Circle, the statement c.enlargeCircle(2); should double the radius of the circle. A function moveHorizontal(int); which should move the center of the circle in the horizontal direction. For example, if “c” is a circle with center at (5,10), moveHorizontal(3); should move the center to position (8,10). A fuction moveVertical(int); similar to the moveHorizontal(int); function. In the main program, create two objects of class Circle. Find which of the two circles is smaller (by comparing their radii) and enlarge the smaller circle by a factor of 2. Code : #include using namespace std; //Class which holds properties and methods of a class class Circle {     private:         int radius;         int x;         int y;          public:         //Parameterized constructor that creates an object         Circle(int r=0, int xc=0, int yc=0)           {             radius=r;             x=xc;             y=yc;         }              //Member function to find area         int area()         {             return 22*radius*radius/7;         }         //Member function to find circumference         int circumference(){             return 2*22*radius/7;         }              //Member function to print results         void print(int ar, int cf)         {             cout<<"Area of circle with radius "<

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Output not showing fix it.

Need output of this code only.

Tasks which i perform already :

  1. Two additional data members (integers) to store the x and y coordinate of the center of the Circle.
  2. A parameterized constructor.
  3. Set() and Get() methods for each of the data member.
  4. A function to display the data members of the class.
  5. A function enlargeCirlce(int); which increases the radius of the circle by the factor passed as input to the For example, if “c” is an object of class Circle, the statement c.enlargeCircle(2); should double the radius of the circle.
  6. A function moveHorizontal(int); which should move the center of the circle in the horizontal direction. For example, if “c” is a circle with center at (5,10), moveHorizontal(3); should move the center to position (8,10).
  7. A fuction moveVertical(int); similar to the moveHorizontal(int); function.

In the main program, create two objects of class Circle. Find which of the two circles is smaller (by comparing their radii) and enlarge the smaller circle by a factor of 2.

Code :

#include<iostream>

using namespace std;

//Class which holds properties and methods of a class
class Circle {
    private:
        int radius;
        int x;
        int y;
    
    public:

        //Parameterized constructor that creates an object
        Circle(int r=0, int xc=0, int yc=0)  
        {
            radius=r;
            x=xc;
            y=yc;
        }
    
        //Member function to find area
        int area()
        {
            return 22*radius*radius/7;
        }

        //Member function to find circumference
        int circumference(){
            return 2*22*radius/7;
        }
    
        //Member function to print results
        void print(int ar, int cf)
        {
            cout<<"Area of circle with radius "<<radius<<" is "<<ar<<" and circumference of circle is "<<cf<<endl;
        }
        
        //set methods
        void setRadius(int r)
        {
            radius=r;
        }
        
        void setX(int xc)
        {
            x=xc;
        }
        
        void setY(int yc)
        {
            y=yc;
        }
        
        //get methods
        int getRadius()
        {
            return radius;
        }
        
        int getX()
        {
            return x;
        }
        
        int getY()
        {
            return y;
        }
        
        void enlargeCircle(int c)
        {
            radius=c*radius;
        }
        
        void moveHorizontal(int c)
        {
            x=x+c;
        }
        
        void moveVertical(int c)
        {
            y=y+c;
        }
        
        //Member function to display data members 
        void printMembers()
        {
            cout << "x coordinate: " << x << endl;
            cout << "y coordinate: " << y << endl;
            cout << "Radius: " << radius << endl;
        }
};
  
int main()
{
    Circle c1(49),c2(61);     //Creating two objects of class circle
    
    if(c1.getRadius()<c2.getRadius())   //if c1 has smaller radius 
        c1.enlargeCircle(2);                //enlarge it by 2 
        
    else if(c2.getRadius()<c1.getRadius())  //if c2 has smaller radius
        c2.enlargeCircle(2);                    //enlarge it by 2 
    
    return 0;
}

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY