Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here is another question that I\"m not quit getting it. Please someone in Chegg

ID: 3591569 • Letter: H

Question

Here is another question that I"m not quit getting it. Please someone in Chegg help me out and give an explanation of it. Below is information about the question.

I'll appreciate it and thank you for your help.

==============================================================

Create a program in Eclipse (C++) that contains the following:

Create a class of whatever name you desire with at least two public function prototypes of int, char, or bool with names of your choice. In addition, declare two variables and another function prototype that are private of whatever type you choose.

Within the main function create an object of the class and with that object perform at least two calls to the member functions of that class. You do not have to worry about creating the functions themselves, just declare their prototypes in the class. Also, the program doesn’t have to actually do anything other than be declared properly and free of errors.  

Explanation / Answer

#include<iostream>

using namespace std;

class Test

{

    private:

       

        int x;

        char y;

       

        bool fxn1()

        {

            return true;

        }

       

        int fxn2()

        {

            return 1;

        }

        

        public:

           

            Test(int x, char y)

            {

                this->x = x;

                this->y = y;

            }

       

            int getX()

            {

                return x;

            }

           

            char getY()

            {

                return y;

            }

           

            bool isXPositive()

            {

                if(x >= 0)

                    return true;

                return false;

            }

};

int main()

{

    Test ob(2, 'y');

   

    cout<<"X : "<<ob.getX();

    cout<<" Y : "<<ob.getY();

   

    return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote