-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmployee.java
76 lines (60 loc) · 1.85 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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;
}
public double tax(){
if(this.salary<1000){
return salary;
}
else{
double tax = salary*(0.03);
return tax;
}
}
public int bonus(){
if(this.workHours<40){
return workHours;
}
else{
int bonus = (workHours-40)*30;
return bonus;
}
}
public double raiseSalary(){
double maasArtis;
if((2021-this.hireYear) > 10){
maasArtis = salary*(0.05);
return maasArtis;
}
else if((2021-this.hireYear)>9 && (2021-hireYear)<20){
maasArtis = salary*(0.10);
return maasArtis;
}
else if((2021-this.hireYear)>19){
maasArtis = salary*(0.15);
return maasArtis;
}
return 0;
}
public String toString(){
double total = salary -tax()+bonus()+raiseSalary();
double tot = salary +bonus()-tax();
System.out.println("adı: "+this.name);
System.out.println("maaşı: "+this.salary);
System.out.println("çalışma saati: "+this.workHours);
System.out.println("başlangıc yılı: "+this.hireYear);
System.out.println("vergi :"+tax());
System.out.println("bonus: "+bonus());
System.out.println("maaş artışı: "+raiseSalary());
System.out.println("vergi ve bonuslarla beraber maaş: "+tot);
System.out.println("toplam maaaş: "+total);
return null;
}
}