Teacher’s Data+Salary Calculator+(Default+Overloaded) Constructor+ Set&Get Statement – C++ Language

#include <iostream>

using namespace std;

class teacher{
private:
string name;
string qualification;
int phone;
float daily_salary;
int absents;
int presents;
public:

void setdata(){
cout<<“Enter Name,Qualification,Phone Number,Daily salary,Presents,Absents: “<<endl;
cin>>name>>qualification>>phone>>daily_salary>>presents>>absents;}

void setname(){
cout<<“Enter name: “<<endl;
cin>>name;}
void setqualification(){
cout<<“Enter qualification: “<<endl;
cin>>qualification;}
void setphone(){
cout<<“Enter phone number: “<<endl;
cin>>phone;}
void setdaily_salary(){
cout<<“Enter daily salary: “<<endl;
cin>>daily_salary;}
void setpresents(){
cout<<“Enter presents: “<<endl;
cin>>presents;}
void setabsents(){
cout<<“Enter absents: “<<endl;
cin>>absents;}
string getname(){
return name;}
string getqualification(){
return qualification;}
int getphone(){
return phone;}
float getdaily_salary(){
return daily_salary;}
int getpresents(){
return presents;}
int getabsents(){
return absents;}

showdata()
{
cout<<“\nTeacher’s name:\n”<<name;
cout<<“\nTeacher’s qualification:\n”<<qualification;
cout<<“\nTeacher’s phone number:\n”<<phone;
cout<<“\nTeacher’s daily salary:\n”<<daily_salary;
cout<<“\nTeacher’s absents:\n”<<absents;
cout<<“\nTeacher’s presents:\n”<<presents;
}
calculate_salary()
{
int i;
i=presents*daily_salary;
cout<<“\nThe salary of the employee is:\n”<<i;
}

teacher()
{
name= “XYZ”;
qualification= “BS”;
phone=0332;
daily_salary=10;
absents=5;
presents=25;

}
teacher(string n,string q,int pn,float d,int a,int p)
{
name=n;
qualification=q;
phone=pn;
daily_salary=d;
absents=a;
presents=p;
}
};

int main(int argc,char** argv)
{
teacher t1,t2,t3,t4(“ABC”,”MS”,032,34,23,7);
cout<<“\nEnter the data for teacher 1\n”;
t1.setdata();
cout<<“\nThe data of teacher 1 is\n”;
t1.showdata();
t1.calculate_salary();
cout<<“\nThe data of teacher 2 is\n”;
t2=t1; //Copy constructor//
t2.showdata();
t2.calculate_salary();
cout<<“\nThe data of teacher 3 is\n”;
t3.showdata(); //Default constructor called//
t3.calculate_salary();
cout<<“\nThe data of teacher 4 is\n”;
t4.showdata(); //Overloaded constructor called//
t4.calculate_salary();
return 0;
}