Object Oriented Programming Practice (Intake 41)

Question

Write a program using three classes named cricket,football and badminton where the constructor of each class takes one int and one char value as argument. The constructors contain the message”in cricket clss”,”in football class”,”in badminton class”respectively.Complete the program considering the followingh case:

  1. cricket and football are base class for badminton class and badminton is derived class who inherits from both cricket and football.
in progress 0
Ask me anything 10 months 24 Answers 426 views 0

Answers ( 24 )

  1. Name: Tamanna Tasnim
    ID:142

    #include
    using namespace std;
    class cricket
    {
    public:
    cricket(char=’x’,int=1)
    {
    char c;
    int x;
    cout<<"in cricket class"<<endl;
    }
    };
    class football :public cricket
    {
    public:
    football(char='y',int=1)
    {
    char c;
    int y;
    cout<<"in football class"<<endl;
    }
    };
    class badminton :public football
    {
    public:
    badminton(char='z',int=1)
    {
    char c;
    int z;
    cout<<"in badminton class"<<endl;
    }
    };
    int main()
    {
    badminton obj;
    return 0;
    }

  2. ID:18192103139
    #include
    using namespace std;
    class cricket
    {
    public:
    cricket(char=’x’,int=1)
    {
    char c;
    int x;
    cout<<"in cricket class"<<endl;
    }
    };
    class football :public cricket
    {
    public:
    football(char='y',int=1)
    {
    char c;
    int y;
    cout<<"in football class"<<endl;
    }
    };
    class badminton :public football
    {
    public:
    badminton(char='z',int=1)
    {
    char c;
    int z;
    cout<<"in badminton class"<<endl;
    }
    };
    int main()
    {
    badminton obj;
    return 0;
    }

  3. Name:Sanjara
    Id:166
    Section:4

    #include
    using namespace std;

    class cricket{
    int x;
    char y;
    public:
    cricket(int i,char j)
    {
    x=i;
    y=j;
    }
    void show1()
    {
    cout<<y<<endl;
    }
    };

    class football{
    int m;
    char n;
    public:
    football(int i,char j)
    {
    m=i;
    n=j;
    }
    void show2()
    {
    cout<<n<<endl;
    }
    };
    class badminton:public cricket,public football{
    int a;
    char b;
    public:
    badminton(int i,char j,int k,char l,int c,char d):cricket(k,l),football(c,d)
    {
    a=i;
    b=j;
    }
    void show3()
    {
    cout<<b<<endl;
    }
    };
    int main()
    {
    badminton obj1("in cricket class","in football class","in badminton class");
    obj1.show1();

    obj1.show2();

    obj1.show3();
    return 0;
    }

  4. Name: sabila Rahman
    ID:136

    #include
    using namespace std;
    class cricket
    {
    public:
    cricket(char=’x’,int=1)
    {
    char c;
    int x;
    cout<<"in cricket class"<<endl;
    }
    };
    class football :public cricket
    {
    public:
    football(char='y',int=1)
    {
    char c;
    int y;
    cout<<"in football class"<<endl;
    }
    };
    class badminton :public football
    {
    public:
    badminton(char='z',int=1)
    {
    char c;
    int z;
    cout<<"in badminton class"<<endl;
    }
    };
    int main()
    {
    badminton obj;
    return 0;
    }

  5. Name: shaminur Rahman
    ID:158

    #include
    using namespace std;
    class cricket
    {
    public:
    cricket(char=’x’,int=1)
    {
    char c;
    int x;
    cout<<"in cricket class"<<endl;
    }
    };
    class football :public cricket
    {
    public:
    football(char='y',int=1)
    {
    char c;
    int y;
    cout<<"in football class"<<endl;
    }
    };
    class badminton :public football
    {
    public:
    badminton(char='z',int=1)
    {
    char c;
    int z;
    cout<<"in badminton class"<<endl;
    }
    };
    int main()
    {
    badminton obj;
    return 0;
    }

  6. Name: Md. Mintu Hossain
    ID: 17181103110

    #include
    using namespace std;
    class cricket
    {
    public:
    cricket(char=’C’,int=75)
    {
    char ch1;
    int val_1;
    cout<<"in cricket class"<<endl;
    }
    };
    class football:public cricket
    {
    public:
    football(char='F',int=77)
    {
    char ch2;
    int val_2;
    cout<<"in football class"<<endl;
    }
    };
    class badminton:public football
    {
    public:
    badminton(char='B',int=79)
    {
    char ch3;
    int vla_3;
    cout<<"in badminton class"<<endl;
    }
    };
    int main()
    {
    badminton ob;
    return 0;
    }

  7. Asfack uddin nabil
    Id 173
    Sec 4

    #include
    using namespace std;
    class cricket
    {
    public:
    cricket(char=’C’,int=75)
    {
    char ch1;
    int val_1;
    cout<<"in cricket class"<<endl;
    }
    };
    class football:public cricket
    {
    public:
    football(char='F',int=77)
    {
    char ch2;
    int val_2;
    cout<<"in football class"<<endl;
    }
    };
    class badminton:public football
    {
    public:
    badminton(char='B',int=79)
    {
    char ch3;
    int vla_3;
    cout<<"in badminton class"<<endl;
    }
    };
    int main()
    {
    badminton ob;
    return 0;
    }

  8. Name: Rakibul Hasan Shafin
    ID: 18192103165
    Intake:41
    Section:04
    #include
    using namespace std;
    class cricket
    {
    public:
    cricket(char=’C’,int=75)
    {
    char ch1;
    int val_1;
    cout<<"in cricket class"<<endl;
    }
    };
    class football:public cricket
    {
    public:
    football(char='F',int=77)
    {
    char ch2;
    int val_2;
    cout<<"in football class"<<endl;
    }
    };
    class badminton:public football
    {
    public:
    badminton(char='B',int=79)
    {
    char ch3;
    int vla_3;
    cout<<"in badminton class"<<endl;
    }
    };
    int main()
    {
    badminton ob;
    return 0;
    }

  9. Name: Rois Uddin Khan Emon
    Intake: 41
    Sec: 4
    ID: 18192103153

    #include
    using namespace std;
    class cricket
    {
    public:
    cricket(char=’C’,int=75)
    {
    char ch1;
    int val_1;
    cout<<"in cricket class"<<endl;
    }
    };
    class football:public cricket
    {
    public:
    football(char='F',int=77)
    {
    char ch2;
    int val_2;
    cout<<"in football class"<<endl;
    }
    };
    class badminton:public football
    {
    public:
    badminton(char='B',int=79)
    {
    char ch3;
    int vla_3;
    cout<<"in badminton class"<<endl;
    }
    };
    int main()
    {
    badminton ob;
    return 0;
    }

  10. Name:Nasrin
    Id:157
    Section:4

    #include
    using namespace std;

    class cricket{
    int x;
    char y;
    public:
    cricket(int i,char j)
    {
    x=i;
    y=j;
    }
    void show1()
    {
    cout<<y<<endl;
    }
    };

    class football{
    int m;
    char n;
    public:
    football(int i,char j)
    {
    m=i;
    n=j;
    }
    void show2()
    {
    cout<<n<<endl;
    }
    };
    class badminton:public cricket,public football{
    int a;
    char b;
    public:
    badminton(int i,char j,int k,char l,int c,char d):cricket(k,l),football(c,d)
    {
    a=i;
    b=j;
    }
    void show3()
    {
    cout<<b<<endl;
    }
    };
    int main()
    {
    badminton obj1("in cricket class","in football class","in badminton class");
    obj1.show1();

    obj1.show2();

    obj1.show3();
    return 0;
    }

  11. Name : Md Masudul Islam Asif
    . ID : 147

    #include
    using namespace std;
    class cricket
    {
    public:
    cricket(char=’C’,int=75)
    {
    char ch1;
    int val_1;
    cout<<"in cricket class"<<endl;
    }
    };
    class football:public cricket
    {
    public:
    football(char='F',int=77)
    {
    char ch2;
    int val_2;
    cout<<"in football class"<<endl;
    }
    };
    class badminton:public football
    {
    public:
    badminton(char='B',int=79)
    {
    char ch3;
    int vla_3;
    cout<<"in badminton class"<<endl;
    }
    };
    int main()
    {
    badminton ob;
    return 0;
    }

  12. Name: MD Tayeb
    Intake: 41
    Sec: 4
    ID:18192103164

    #include
    using namespace std;
    class cricket
    {
    public:
    cricket(char=’x’,int=1)
    {
    char c;
    int x;
    cout<<"in cricket class"<<endl;
    }
    };
    class football :public cricket
    {
    public:
    football(char='y',int=1)
    {
    char c;
    int y;
    cout<<"in football class"<<endl;
    }
    };
    class badminton :public football
    {
    public:
    badminton(char='z',int=1)
    {
    char c;
    int z;
    cout<<"in badminton class"<<endl;
    }
    };
    int main()
    {
    badminton obj;
    return 0;
    }

  13. ID : 18192104180

    #include
    using namespace std;
    class cricket
    {
    int x;
    char ch;
    public :
    cricket(int n, char c)
    {
    x=n;
    ch=c;
    cout << "in cricket class " << endl;
    }
    };
    class football
    {
    int x;
    char ch;
    public :
    football(int i, char j)
    {
    i=x;
    ch=j;
    cout << "in football class "<< endl;
    }

    };
    class badminton : public cricket, public football
    {
    int y;
    char h;
    public:
    badminton(int k,char l,int n,char c,int i,char j):cricket(n,c),football(i,j)
    {
    k=y;
    l=h;
    cout << "in badminton class ";
    }
    };
    int main()
    {
    badminton obj;
    return 0;
    }

  14. D.k.Shah Alam
    id:18192103 176

    #include
    using namespace std;
    class cricket
    {
    public:
    int a;
    char b;
    cricket(int x,char y)
    {
    a=x;
    b=y;
    cout<<"in cricket class"<<endl;
    }
    };
    class football
    {
    public:
    int a;
    char b;
    football(int x,char y)
    {
    a=x;
    b=y;
    cout<<"in football class"<<endl;
    }
    };
    class badminton:public cricket,public football
    {
    public:
    int a;
    char b;
    badminton(int x,char y):cricket(x,y),football(x,y)
    {
    a=x;
    b=y;
    cout<<"in badminton class"<<endl;
    }
    };

    int main()
    {

    badminton ob(5,'a');

    return 0;
    }

  15. Name:Md. Emon Ali
    Id:154
    #include
    using namespace std;
    class cricket
    {
    public:
    cricket(char=’x’,int=1)
    {
    char c;
    int x;
    cout<<"in cricket class"<<endl;
    }
    };
    class football :public cricket
    {
    public:
    football(char='y',int=1)
    {
    char c;
    int y;
    cout<<"in football class"<<endl;
    }
    };
    class badminton :public football
    {
    public:
    badminton(char='z',int=1)
    {
    char c;
    int z;
    cout<<"in badminton class"<<endl;
    }
    };
    int main()
    {
    badminton obj;
    return 0;
    }

  16. Name: Arup Raton Chowdhury
    ID:155

    #include
    using namespace std;
    class cricket
    {
    public:
    cricket(char=’x’,int=1)
    {
    char c;
    int x;
    cout<<"in cricket class"<<endl;
    }
    };
    class football :public cricket
    {
    public:
    football(char='y',int=1)
    {
    char c;
    int y;
    cout<<"in football class"<<endl;
    }
    };
    class badminton :public football
    {
    public:
    badminton(char='z',int=1)
    {
    char c;
    int z;
    cout<<"in badminton class"<<endl;
    }
    };
    int main()
    {
    badminton obj;
    return 0;
    }

  17. MD Ashraful Hossain

    ID : 18192104137

    #include
    using namespace std;
    class cricket
    {
    int x;
    char ch;
    public :
    cricket(int n, char c)
    {
    x=n;
    ch=c;
    cout << "in cricket class " << endl;
    }
    };
    class football
    {
    int x;
    char ch;
    public :
    football(int i, char j)
    {
    i=x;
    ch=j;
    cout << "in football class "<< endl;
    }
    };
    class badminton : public cricket, public football
    {
    int y;
    char h;
    public:
    badminton(int k,char l,int n,char c,int i,char j):cricket(n,c),football(i,j)
    {
    k=y;
    l=h;
    cout << "in badminton class ";
    }
    };
    int main()
    {
    badminton obj;
    return 0;
    }

  18. //Name: Syeda Nafia Sultana,Intake: 37,Id: 17181103058
    #include
    using namespace std;
    class Cricket
    {
    public:
    Cricket (int a, char b)
    {
    cout<<"In cricket class"<<endl<<a<<endl<<b<<endl;
    }
    };
    class Football
    {
    public:
    Football (int c, char d)
    {
    cout<<"In football class"<<endl<<c<<endl<<d<<endl;
    }
    };
    class Badminton : public Cricket,public Football
    {
    public:
    Badminton (int e, char f) : Cricket(e,f),Football(e,f)
    {
    cout<<"In badminton class"<<endl<<e<<endl<<f<<endl;
    }
    };
    int main()
    {
    Badminton ob(6,'B');
    }

  19. Name: Rois Uddin Khan Emon
    Intake: 41
    Sec: 4
    ID: 18192103153

    #include
    #include

    using namespace std;

    class cricket{
    public:
    cricket(int=1, char=’c’){
    cout<<"in cricket clss"<<endl;
    }
    };

    class football{
    public:
    football(int=1, char='c'){
    cout<<"in football class"<<endl;
    }
    };

    class badminton : public cricket, public football{
    public:
    badminton(int=1, char='c'){
    cout<<"in badminton class"<<endl;
    }
    };

    int main(){
    badminton obj;
    }

  20. name:Md. Emon Ali
    id:154

    #include
    using namespace std;
    class Cricket
    {
    public:
    Cricket (int a, char b)
    {
    cout<<"In cricket class"<<endl<<a<<endl<<b<<endl;
    }
    };
    class Football
    {
    public:
    Football (int c, char d)
    {
    cout<<"In football class"<<endl<<c<<endl<<d<<endl;
    }
    };
    class Badminton : public Cricket,public Football
    {
    public:
    Badminton (int e, char f) : Cricket(e,f),Football(e,f)
    {
    cout<<"In badminton class"<<endl<<e<<endl<<f<<endl;
    }
    };
    int main()
    {
    Badminton ob(6,'B');
    }

  21. Name:Tabassum Mehrin Prova
    ID:177
    Sec:4
    #include
    using namespace std;
    class Cricket
    {
    public:
    Cricket (int a, char b)
    {
    cout<<"In cricket class"<<endl<<a<<endl<<b<<endl;
    }
    };
    class Football
    {
    public:
    Football (int c, char d)
    {
    cout<<"In football class"<<endl<<c<<endl<<d<<endl;
    }
    };
    class Badminton : public Cricket,public Football
    {
    public:
    Badminton (int e, char f) : Cricket(e,f),Football(e,f)
    {
    cout<<"In badminton class"<<endl<<e<<endl<<f<<endl;
    }
    };
    int main()
    {
    Badminton ob(6,'B');
    }

  22. Arman Hossain
    Id-18192103156

    #include
    using namespace std;
    class cricket
    {
    public:
    int a;
    char b;
    cricket(int x,char y)
    {
    a=x;
    b=y;
    cout<<"in cricket class"<<endl;
    }
    };
    class football
    {
    public:
    int a;
    char b;
    football(int x,char y)
    {
    a=x;
    b=y;
    cout<<"in football class"<<endl;
    }
    };
    class badminton:public cricket,public football
    {
    public:
    int a;
    char b;
    badminton(int x,char y):cricket(x,y),football(x,y)
    {
    a=x;
    b=y;
    cout<<"in badminton class"<<endl;
    }
    };

    int main()
    {

    badminton ob(5,'a');

    return 0;
    }

  23. md mahbubur rahman khan
    id-18192103150

    #include
    using namespace std;
    class cricket
    {
    public:
    int a;
    char b;
    cricket(int x,char y)
    {
    a=x;
    b=y;
    cout<<"in cricket class"<<endl;
    }
    };
    class football
    {
    public:
    int a;
    char b;
    football(int x,char y)
    {
    a=x;
    b=y;
    cout<<"in football class"<<endl;
    }
    };
    class badminton:public cricket,public football
    {
    public:
    int a;
    char b;
    badminton(int x,char y):cricket(x,y),football(x,y)
    {
    a=x;
    b=y;
    cout<<"in badminton class"<<endl;
    }
    };

    int main()
    {

    badminton ob(5,'a');

    return 0;
    }

Leave an answer