Output not showing fix it. Need output of this code only. Tasks which i perform already : Two additional data members (integers) to store the x and y coordinate of the center of the Circle. A...



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


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=""><><" is=""><><" and="" circumference="" of="" circle="" is=""><><>
        }

        //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=""><>
            cout < "y="" coordinate:="" "="">< y=""><>
            cout < "radius:="" "="">< radius=""><>
        }
};

int main()
{
    Circle c1(49),c2(61);     //Creating two objects of class circle

    if(c1.getRadius()
        c1.enlargeCircle(2);                //enlarge it by 2

    else if(c2.getRadius()
        c2.enlargeCircle(2);                    //enlarge it by 2

    return 0;
}

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here