-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmployee.java
78 lines (67 loc) · 1.67 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
77
78
package ArrayList;
*
* @author fadhlinqistina
*/
public class Employee {
static int getSalary;
String name;
int empId;
int hireYear;
int hourWork;
double rate;
//default constructor
public Employee(){
name = " ";
empId = 0;
hireYear = 0;
hourWork = 0;
rate = 0;
}
//normal constructor
public Employee(String name, int empId, int hireYear, int hourWork, double rate, double salary){
this.name = name;
this.empId = empId;
this.hireYear = hireYear;
this.hourWork = hourWork;
this.rate = rate;
}
//mutator
public void Employee(String nm, int id, int year, int hour, double rm, double sal){
name = nm;
empId = id;
hireYear = year;
hourWork = hour;
rate = rm;
double salary = sal;
}
//accessor
public String getName(){
return name;
}
public int getEmpId(){
return empId;
}
public int getHireYear(){
return hireYear;
}
public int getHourWork(){
return hourWork;
}
public double getRate(){
return rate;
}
public int getSalary(){
int salary = 0;
return salary;
}
//print
public String toString(){
return " \n Name : " + name + "\n Employee Id : " + empId + "\n Hire Year : " +
hireYear + "\n Hour Work : " + hourWork + "\n Rate : RM " + rate;
}
//calSalary
public void calSalary(int salary,int hourWork, int rate){
salary = (int) (hourWork * rate);
System.out.println(salary);
}
}