-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmployee.java
56 lines (49 loc) · 1.66 KB
/
Employee.java
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
public class Employee {
String name;
int salary;
int workHours;
int hireYear;
Employee(String name, int salary, int workHours, int hireYear){
this.name = name;
this.salary = salary;
this.workHours = workHours;
this.hireYear = hireYear;
}
int tax(){
if(this.salary < 1000){
System.out.println("Employees with a salary of less than 1000 TL are exempt from tax.");
return this.salary;
} else if(this.salary >= 1000) {
int tax = (this.salary * 3) / 100;
System.out.println("Tax: " + tax);
return this.salary = this.salary - (this.salary * 3)/100;
}
return 0;
}
int bonus(){
if(this.workHours > 40){
System.out.println("Bonus: " + this.workHours * 30);
return this.salary = this.salary + this.workHours * 30;
}
return this.salary;
}
int raiseSalary(){
int duration = 2021 - this.hireYear;
if(duration < 10){
return this.salary = this.salary + (this.salary* 5) /100;
}
else if(duration > 9 && duration< 20){
return this.salary = this.salary + (this.salary * 10) / 100;
}
else if(duration > 19){
this.salary = this.salary + (this.salary * 15) / 100;
}
return 0;
}
void employeeInfo(){
System.out.println("Name: " + this.name);
System.out.println("Salary: " + this.salary);
System.out.println("Work Hours: " + this.workHours);
System.out.println("Hire Year: " + this.hireYear);
}
}