forked from avani112/HacktoberFest2021-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSalary.sol
52 lines (39 loc) · 1.08 KB
/
Salary.sol
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
pragma solidity >= 0.7.0 < 0.9.0;
contract Employee {
uint256 salary;
function set(uint256 sal) virtual public {
salary = sal;
}
function get() public virtual view returns(uint256) {
return salary;
}
}
contract Clerk is Employee {
uint256 HRA;
uint256 DA;
uint256 TotalSalary;
function set(uint256 s) override(Employee) virtual public{
super.set(s);
HRA = (10 * super.get())/100;
DA = (50 * super.get())/100;
}
function cal() public {
TotalSalary = super.get() + HRA + DA;
}
function get() override(Employee) virtual public view returns(uint256){
return TotalSalary;
}
}
contract Officer is Clerk {
function set(uint256 s2) override(Clerk) public{
super.set(s2);
HRA = (20 * super.get())/100;
DA = (50 * super.get())/100;
}
function cal2() public {
TotalSalary = super.get() + HRA + DA;
}
function get() override(Clerk) public view returns(uint256){
return TotalSalary;
}
}