-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemp_src.cpp
More file actions
115 lines (108 loc) · 2.39 KB
/
emp_src.cpp
File metadata and controls
115 lines (108 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include"Emp.h"
/*---------Employee-----------*/
Employee::Employee()
{
this->eid = 0;
this->basic = 0.0;
}
Employee::Employee(int id, const char *str, double bas)
{
this->eid = id;
strcpy(this->name, str);
this->basic = bas;
}
void Employee::display()
{
cout << "Emp Id:: " << this->eid << endl;
cout << "Emp Name:: " << this->name << endl;
cout << "Emp Basics:: " << this->basic << endl;
}
void Employee::accept()
{
cout << "Emp Id:: ";
cin>> this->eid;
cout << "Emp Name:: ";
cin>> this->name;
cout << "Emp Basics:: ";
cin>> this->basic;
}
/*------------Programmer----------*/
Programmer::Programmer()
{
this->costPerHrs = 0;
this->extraHrs = 0;
}
Programmer::Programmer(int id, const char*str, double bas, int c, int ex) :Employee(id, str, bas)
{
this->costPerHrs = c;
this->extraHrs = ex;
}
void Programmer::accept() {
Employee::accept();
cout << " Programmers CostperHr:: ";
cin >> this->costPerHrs;
cout << "Extra Hr:: ";
cin>> this->extraHrs;
}
void Programmer::display()
{
Employee::display();
cout << " Programmers CostperHr:: " << this->costPerHrs << "Extra Hr:: " << this->extraHrs << endl;
}
double Programmer::CalSal()
{
return this->basic + this->costPerHrs + this->extraHrs;
}
/*------------Admin----------*/
Admin::Admin()
{
this->incentive = 0;
}
Admin::Admin(int id, const char*str, double bas, double i) :Employee(id, str,bas)
{
this->incentive = i;
}
void Admin::display()
{
Employee::display();
cout << " Admin incentive:: " << this->incentive << endl;
}
void Admin::accept()
{
Employee::accept();
cout << " Admin incentive:: ";
cin>>this->incentive;
}
double Admin::CalSal()
{
return this->basic + this->incentive;
}
/*------------SalesMgr----------*/
SalesMgr::SalesMgr()
{
this->target = 0;
this->comm = 0;
}
SalesMgr::SalesMgr(int id, const char*str, double bas, int t, double com) :Employee(id, str, bas)
{
this->target = t;
this->comm = com;
}
void SalesMgr::display()
{
Employee::display();
cout << " SalesMgr target:: " << this->target << " Commision:: " << this->comm << endl;
cout << "Computed salary:: " << CalSal();
}
void SalesMgr::accept()
{
Employee::accept();
cout << " SalesMgr target:: ";
cin >> this->target;
cout << " Commision:: ";
cin >> this->comm;
}
double SalesMgr::CalSal()
{
return this->basic + (this->target * this->comm);
}