Create a class named as Recruitment which is derived from two base classes named as
Basic qualification and interview. Basic qualification contains the Name, marks in last
qualification, Interview class contains the marks obtained in interview. Recruitment class
will display the message as recruited or not recruited. Criteria for recruitment is if the
marks in last qualification is more than 80 and interview marks are greater than equal to 6
out of 10 for interview marks. Make sure that negative marks are not allowed.
#include <iostream>
using namespace std;
//define class BasicQualification
class BasicQualification{
protected:
string name;
int qual_marks;
};
//define class interview
class Interview{
protected:
int inter_marks;
};
//define class recruitment
class Recruitment: public BasicQualification, public Interview{
public:
void Display()
{
//get input from the user
cout<<"Enter name:";
cin>>name;
cout<<"Enter the basic qualification marks: ";
cin>>qual_marks;
cout<<"Enter interview marks: ";
cin>>inter_marks;
//check if the marks entered are negative
if (qual_marks<0 || inter_marks<0){
cout<<"Invalid marks";
}
else if (qual_marks>80 && inter_marks>=6){
cout<<name<<" is Recruited"<<endl;
}
else{
cout<<name<<" is not recruited"<<endl;
}
}
};
int main(){
Recruitment r;
r.Display();
return 0;
}
Comments
Leave a comment