Design a Payroll System Using Single Inheritance
Input:
Enter the Number of employee: 1
Enter the employee No: 033
Enter the employee Name: Md. Ahsan Arif
Enter the designation: Asst. Professor
Enter the basic pay: 50,000
Enter the HR allowance: 9,000
Enter the Dearness allowance: 5,000
Enter the profitability Fund: 3,000
Output:
E.No E.name Designation BP HRA DA PF NP
033 Md. Ahsan Arif Manager 50000 9000 5000 3000 67000
Hits:
If one derived class(sub class) inherits
from only one base class(super class), it is the most simplest form of
Inheritance and called by Single Inheritance.
#include
ReplyDeleteusing namespace std;
class employee
{
public:
int ENo;
char name[30],Desig[20];
void get()
{
cout<<"Enter the employee number :";
cin>>ENo;
cout<<"Enter the employee name :";
cin>>name;
cout<<"Enter the desination :";
cin>>Desig;
}
};
class salary:public employee
{
float BP,HRA,DA,PF,NP;
public:
void get1()
{
cout<<"Enter the basic pay :";
cin>>BP;
cout<<"Enter the Human Resource Allowance :";
cin>>HRA;
cout<<"Enter the dearness Allowance:";
cin>>DA;
cout<<"Enter the profitablity fund :";
cin>>PF;
}
void calculate()
{
NP=BP+HRA+DA+PF;
}
void display()
{
cout<<ENo<<"\t"<<name<<"\t"<<Desig<<"\t"<<BP<<"\t"<<HRA<<"\t"<<DA<<"\t"<<PF<<"\t"<<NP<<"\n";
}
};
int main()
{
int i=1;
char ch;
salary s[10];
s[i].get();
s[i].get1();
s[i].calculate();
cout<<"\nE.No\t E.name\t Desig\t BP\t HRA\t DA\t PF\t NP\n";
s[i].display();
}
using C++
ReplyDelete#include
#include
#include
using namespace std;
class Parent
{
public:
int numOfEmp;
void takeInput(int i){
proNumOfEmp = numOfEmp = i;
}
void printDetalis(int i){
if (i == 0)
cout << "Enter the employee No: ";
else if (i == 1)
cout << "Enter the employee Name: ";
else if (i == 2)
cout << "Enter the designation: ";
else if (i == 3)
cout << "Enter the basic pay: ";
else if (i == 4)
cout << "Enter the HR allowance: ";
else if (i == 5)
cout << "Enter the Dearness allowance: ";
else if (i == 6)
cout << "Enter the profitability Fund: ";
}
void detailsAbout(){
int np = 0;
string detailtList[numOfEmp][8];
for (int i = 0; i < numOfEmp; i++){
for (int j = 0; j < 7; j++){
printDetalis(j);
getline(cin, detailtList[i][j]);
if (j == 6){
for (int k = 3; k < 7; k++){
int sum;
stringstream give(detailtList[i][k]);
give >> sum;
np += sum;
}
stringstream give;
give << np;
detailtList[i][j+1] = give.str();
np = 0;
}
}
}
for (int i = 0; i < numOfEmp; i++){
for (int j = 0; j < 8; j++)
storeEmpDetails[i][j] = detailtList[i][j];
}
}
protected:
int proNumOfEmp;
string storeEmpDetails[20][8]; //User can not be store more than 20 employ details!!//
};
class Child: public Parent
{
public:
void showEmpDetails(){
cout << "E.No \t E.name \t Designation \t BP \t HRA \t DA \t PF \t NP" << "\n";
for (int i = 0; i < proNumOfEmp; i++){
for (int j = 0; j < 8; j++)
cout << storeEmpDetails[i][j] << "\t";
cout << "\n";
}
}
};
int main()
{
string i;
cout << "Enter the Number of employee: ";
getline(cin, i);
stringstream give(i);
int numOfEmp;
give >> numOfEmp;
Child ochena;
ochena.takeInput(numOfEmp);
ochena.detailsAbout();
cout << "\n";
ochena.showEmpDetails();
return 0;
}
Thanks Sir!
DeleteThis comment has been removed by the author.
ReplyDelete#include
ReplyDelete#include
using namespace std;
class base
{
public:
int n,bp,hr,da,pf,sum=0;
string name,des;
base()
{
cout<<"Enter the Employee No:";
cin>>n;
cout<<"Enter the Employee Name:";
cin>>name;
cout<<"Enter the Employee Designation:";
cin>>des;
cout<<"Enter Basic Pay:";
cin>>bp;
cout<<"Enter the HR allowance:";
cin>>hr;
cout<<"Enter the Dearness allowance:";
cin>>da;
cout<<"Enter the Profitability fund:";
cin>>pf;
cout<>em;
for(int i=1; i<=em; i++)
{
payment appel;
appel.payments();
cout<<endl;
}
}
Sir source code thik vabe publish hocchena......
ReplyDeleteproblem:Design payroll system using single inheritance.
ReplyDeleteMEHEDI HASAN.
#include.
using namespace std;
class basic
{
public:
int ENo;
char name[30],Desig[20];
void get()
{
cout<<"Enter the employee number :";
cin>>ENo;
cout<<"Enter the employee name :";
cin>>name;
cout<<"Enter the desination :";
cin>>Desig;
}
};
class salary:public basic
{
float BP,HRA,DA,PF,NP;
public:
void get1()
{
cout<<"Enter the basic pay :";
cin>>BP;
cout<<"Enter the Human Resource Allowance :";
cin>>HRA;
cout<<"Enter the dearness Allowance:";
cin>>DA;
cout<<"Enter the profitablity fund :";
cin>>PF;
}
void calculate()
{
NP=BP+HRA+DA+PF;
}
void display()
{
cout<<ENo<<"\t"<<name<<"\t"<<Desig<<"\t"<<BP<<"\t"<<HRA<<"\t"<<DA<<"\t"<<PF<<"\t"<<NP<<"\n";
}
};
int main()
{
int a=1;
char ch;
salary s[10];
s[a].get();
s[a].get1();
s[a].calculate();
cout<<"\nE.No\t E.name\t Desig\t BP\t HRA\t DA\t PF\t NP\n";
s[a].display();
}
#include
ReplyDeleteusing namespace std;
class Payroll
{
public:
int Number;
char Name[30], Designation[20];
void get()
{
cout<<" EMPLOYEE PAYROLL " <>Number;
//cout<<"Enter the Employee No : ";
//cin>>No;
cout<<"Enter the Employee Name :";
cin>>Name;
cout<<"Enter the Desination :";
cin>>Designation;
}
};
class salary:public Payroll
{
float BP,HRA,DA,PF,NP;
public:
void get1()
{
cout<<"Enter the Basic pay :";
cin>>BP;
cout<<"Enter the Human Resource Allowance :";
cin>>HRA;
cout<<"Enter the Dearness Allowance :";
cin>>DA;
cout<<"Enter the Profitablity fund :";
cin>>PF;
}
void calculate()
{
NP=BP+HRA+DA+PF;
}
void display()
{
cout<<Number<<"\t"<<Name<<"\t"<<Designation<<"\t"<<BP<<"\t"<<HRA<<"\t"<<DA<<"\t"<<PF<<"\t"<<NP<<"\n";
}
};
int main()
{
int i=1;
char ch;
salary s[10];
s[i].get();
s[i].get1();
s[i].calculate();
cout<<"E.Nu\tE.name\t Des\t BP\t HRA\t DA\t PF\t NP\n";
s[i].display();
}
#include
ReplyDelete#include
using namespace std;
class payroll
{
public:
void get_heading()
{
cout<<"\nE.No\t E.name\t Desig\t BP\t HRA\t DA\t PF\t NP"<>ENo;
cout<<"Enter the employee name :";
cin>>name;
cout<<"Enter the desination :";
cin>>Desig;
}
void get_salary()
{
cout<<"Enter the basic pay :";
cin>>BP;
cout<<"Enter the Human Resource Allowance :";
cin>>HRA;
cout<<"Enter the dearness Allowance:";
cin>>DA;
cout<<"Enter the profitablity fund :";
cin>>PF;
}
void get_total_salary()
{
NP=BP+HRA+DA+PF;
}
void show()
{
cout<<ENo<<"\t"<<name<<"\t"<<Desig<<"\t"<<BP<<"\t"<<HRA<<"\t"<<DA<<"\t"<<PF<<"\t"<<NP<<endl;
}
};
main()
{
detail obj;
obj.get_employee_detail();
obj.get_salary();
obj.get_total_salary();
obj.get_heading();
obj.show();
}
#include
ReplyDelete#include
using namespace std;
class Rony
{
public:
void Input(int num1)
{
num2=num1;
}
protected:
int num2;
};
class child : public Rony
{
public:
void printDetalis(int i){
if (i == 0)
cout << "Enter the employee No: ";
else if (i == 1)
cout << "Enter the employee Name: ";
else if (i == 2)
cout << "Enter the designation: ";
else if (i == 3)
cout << "Enter the basic pay: ";
else if (i == 4)
cout << "Enter the HR allowance: ";
else if (i == 5)
cout << "Enter the Dearness allowance: ";
else if (i == 6)
cout << "Enter the profitability Fund: ";
}
int func()
{
int i,j;
string arr[num2][8];
for(i=0; i> sum;
np += sum;
}
stringstream give;
give << np;
arr[i][7] = give.str();
}
}
}
cout << "E.No \t E.name \t Designation \t BP \t HRA \t DA \t PF \t NP\n";
for (i = 0; i < num2; i++){
for (j = 0; j < 8; j++)
cout << arr[i][j] << "\t";
cout << "\n";
}
}
};
int main()
{
int num;
string n;
cout << "Enter the Number of employee: ";
getline(cin, n);
stringstream ob(n);
ob >> num;
child obj;
obj.Input(num);
obj.func();
return 0;
}
id:201510660
#include
ReplyDelete#include
using namespace std;
class setu
{
public:
void Input(int num1)
{
num2=num1;
}
protected:
int num2;
};
class child : public setu
{
public:
void printDetalis(int i){
if (i == 0)
cout << "Enter the employee No: ";
else if (i == 1)
cout << "Enter the employee Name: ";
else if (i == 2)
cout << "Enter the designation: ";
else if (i == 3)
cout << "Enter the basic pay: ";
else if (i == 4)
cout << "Enter the HR allowance: ";
else if (i == 5)
cout << "Enter the Dearness allowance: ";
else if (i == 6)
cout << "Enter the profitability Fund: ";
}
int func()
{
int i,j;
string arr[num2][8];
for(i=0; i> sum;
np += sum;
}
stringstream give;
give << np;
arr[i][7] = give.str();
}
}
}
cout << "E.No \t E.name \t Designation \t BP \t HRA \t DA \t PF \t NP\n";
for (i = 0; i < num2; i++){
for (j = 0; j < 8; j++)
cout << arr[i][j] << "\t";
cout << "\n";
}
}
};
int main()
{
int num;
string n;
cout << "Enter the Number of employee: ";
getline(cin, n);
stringstream ob(n);
ob >> num;
child obj;
obj.Input(num);
obj.func();
return 0;
}
id:201510992
TAMANNA RITU
ReplyDeleteID:201510385
#include
using namespace std;
class employee
{
public:
int ENo;
char name[30],Desig[20];
void get()
{
cout<<"Enter the employee number :";
cin>>ENo;
cout<<"Enter the employee name :";
cin>>name;
cout<<"Enter the desination :";
cin>>Desig;
}
};
class salary:public employee
{
float BP,HRA,DA,PF,NP;
public:
void get1()
{
cout<<"Enter the basic pay :";
cin>>BP;
cout<<"Enter the Human Resource Allowance :";
cin>>HRA;
cout<<"Enter the dearness Allowance:";
cin>>DA;
cout<<"Enter the profitablity fund :";
cin>>PF;
}
void calculate()
{
NP=BP+HRA+DA+PF;
}
void display()
{
cout<<ENo<<"\t"<<name<<"\t"<<Desig<<"\t"<<BP<<"\t"<<HRA<<"\t"<<DA<<"\t"<<PF<<"\t"<<NP<<"\n";
}
};
int main()
{
int i=1;
char ch;
salary s[10];
s[i].get();
s[i].get1();
s[i].calculate();
cout<<"\nE.No\t E.name\t Desig\t BP\t HRA\t DA\t PF\t NP\n";
s[i].display();
}
#include
ReplyDeleteusing namespace std;
class employee
{
public:
int Eno;
char name [20],Desig[10];
void get ()
{
cout<<"Enter the employee number:";
cin>>Eno;
cout<<"Enter the employee name:";
cin>>name;
cout<<"Enter the desination:";
cin>>Desig;
}
};
class salary:public employee
{
float BP,HRA,DA,PF,NP;
public:
void get1 ()
{
cout<<"Enter the basic pay :";
cin>>BP;
cout<<"Enter the Human Resource Allowance:";
cin>>HRA;
cout<<"Enter the dearness Allowance :";
cin>>DA;
cout<<"Enter the Profitablity fund :";
cin>>PF;
}
void calculate ()
{
NP=BP+HRA+DA+PF;
}
void display ()
{
cout<<Eno<<"\t"<<Desig<<"\t"<<BP<<"\t"<<HRA<<"\t"<<DA<<"\t"<<PF<<"\t"<<NP<<"\n";
}
};
int main ()
{
int i=1;
char ch;
salary s[10];
s[i].get ();
s[i].get1 ();
s[i].calculate ();
cout<<"\nE.no\t E.name\t Desig\t HRA\t DA\t PF\t NP\n";
s[i].display ();
}
#include
ReplyDeleteusing namespace std;
class base
{
public:
int Number;
char Name[30], Designation[20];
void get()
{
cout<<" EMPLOYEE PAYROLL "<>Name;
cout<<"Enter the Designation :";
cin>>Designation;
}
};
class salary:public base
{
float BP,HRA,DA,PF,NP;
public:
void get_salary()
{
cout<<"Enter the Basic pay :";
cin>>BP;
cout<<"Enter the Human Resource Allowance :";
cin>>HRA;
cout<<"Enter the Dearness Allowance :";
cin>>DA;
cout<<"Enter the Profitability fund :";
cin>>PF;
}
void total()
{
NP=BP+HRA+DA+PF;
}
void show()
{
cout<<Number<<"\t"<<Name<<"\t"<<Designation<<"\t"<<BP<<"\t"<<HRA<<"\t"<<DA<<"\t"<<PF<<"\t"<<NP<<"\n";
}
};
int main()
{
int i=1;
char ch;
salary s[10];
s[i].get();
s[i].get_salary();
s[i].total();
cout<<"E.Nu\tE.name\t Des\t BP\t HRA\t DA\t PF\t NP\n";
s[i].show();
}
ID:201510280
48th batch
#include
ReplyDeleteusing namespace std;
class employee
{
public:
int ENo;
char name[30],desig[20];
void get()
{
cout<<"Enter the Employee number :";
cin>>ENo;
cout<<"Enter the Employee name :";
cin>>name;
cout<<"Enter the Desination :";
cin>>desig;
}
};
class salary:public employee
{
float BP,HRA,DA,PF,NP;
public:
void get1()
{
cout<<"Enter the basic pay :";
cin>>BP;
cout<<"Enter the Human Resource Allowance :";
cin>>HRA;
cout<<"Enter the Dearness Allowance:";
cin>>DA;
cout<<"Enter the Profitablity fund :";
cin>>PF;
}
void calculate()
{
NP=BP+HRA+DA+PF;
}
void display()
{
cout<<ENo<<"\t"<<name<<"\t"<<desig<<"\t"<<BP<<"\t"<<HRA<<"\t"<<DA<<"\t"<<PF<<"\t"<<NP<<"\n";
}
};
int main()
{
int i=1;
char ch;
salary s[10];
s[i].get();
s[i].get1();
s[i].calculate();
cout<<"\nE.No\t E.name\t Desig\t BP\t HRA\t DA\t PF\t NP\n";
s[i].display();
}
Maisha Fahmida
Batch:48th
ID:201511018
#include
ReplyDeleteusing namespace std;
class employ
{
public:
int num;
char n[30], d[20];
void input()
{
cout<<"Enter the employ"<>n;
cout<<"Enter the d:";
cin>>d;
}
};
class salary:public employ
{
float bp, hra, da, pf,np;
public:
void input1()
{
cout<<"Enter the basic pay:";
cin>>bp;
cout<<"Enter the human resource allowance:";
cin>>hra;
cout<<"Enter the dearness allowance:";
cin>>da;
cout<<"Enter the profitablity fund:";
cin>>pf;
}
void calculate()
{
np=bp+hra+da+pf;
}
void display()
{
cout<<num<<"\t"<<n<<"\t"<<d<<"\t"<<bp<<"\t"<<hra<<"\t"<<da<<"\t"<<pf<<"\t"<<np<<"\n";
}
};
int main()
{
int i=1;
char ch;
salary s[20];
s[i].input();
s[i].input1();
s[i]. calculate();
cout<<"E.nu\tE.n\t d\t bp\t hra\t da\t pf\t np\n";
s[i]. display();
}
#include
ReplyDeleteusing namespace std;
class employee
{
public:
int ENo;
char name[30],Desig[20];
void get()
{
cout<<"Enter the employee number :";
cin>>ENo;
cout<<"Enter the employee name :";
cin>>name;
cout<<"Enter the desination :";
cin>>Desig;
}
};
class salary:public employee
{
float BP,HRA,DA,PF,NP;
public:
void get1()
{
cout<<"Enter the basic pay :";
cin>>BP;
cout<<"Enter the Human Resource Allowance :";
cin>>HRA;
cout<<"Enter the dearness Allowance:";
cin>>DA;
cout<<"Enter the profitablity fund :";
cin>>PF;
}
void calculate()
{
NP=BP+HRA+DA+PF;
}
void display()
{
cout<<ENo<<"\t"<<name<<"\t"<<Desig<<"\t"<<BP<<"\t"<<HRA<<"\t"<<DA<<"\t"<<PF<<"\t"<<NP<<"\n";
}
};
int main()
{
int i=1;
char ch;
salary s[10];
s[i].get();
s[i].get1();
s[i].calculate();
cout<<"\nE.No\t E.name\t Desig\t BP\t HRA\t DA\t PF\t NP\n";
s[i].display();
}
These blogs are valuable because these are providing such informative information for all the people.Payroll Direct Deposit
ReplyDelete