Answer to Question #173925 in C++ for Vimal D

Question #173925

Develop a code for the multiple inheritance diagram given below


· The experience details class consisting of data members such as name and total experience.


· The salary details class consisting of data members such as salary.


· The education details class consisting of data members such as degree.


· The promotion class consisting of member function promote() to find the employee promotion for higher grade on satisfying the condition total experience to be greater than 10 and salary to be greater than Rs. 20,000 and the degree qualification to be “PG”, print "PROMOTED FOR HIGHER GRADE". otherwise the employee is not eligible for promotion, print "PROMOTION IS NOT ELIGIBLE


1
Expert's answer
2021-03-25T17:02:38-0400
#include<iostream>
using namespace std;

class experience{
public:
   int total_experience;
   char name;

   void input1() {
       cout << "Enter name and total experience";
       cin>>name>>total_experience;
   }
};

class salary {
public:
   int sal;

   void input2() {
       cout << "Enter salary:";
       cin>>sal;
   }
};
class degree {
  public:
    char degree;
    void input3()
    {
      cout<<" Enter degree";
      cin>>degree;
    }
};

class promotion : public experience, public salary ,public degree{
public:

   void promote() {
       if(total_experience>=10 && salary>=20000 && degree='PG' )
      {
        cout<<"PROMOTED FOR HIGHER GRADE ";
      }
      else{
        cout<<"PROMOTION IS NOT ELIGIBLE ";
      }
   }
};

int main() {

   promotion obj;
   obj.input1();
   obj.input2();
   obj.promote();

   return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS