-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployeeInfo.java
More file actions
112 lines (81 loc) · 2.74 KB
/
EmployeeInfo.java
File metadata and controls
112 lines (81 loc) · 2.74 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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author 565174
*/
public class EmployeeInfo {
//Attributes
protected int employeeNumber;
protected String firstName;
protected String lastName;
protected double deductionRate; //A decimal number
protected String gender; //Male, Female, Other
protected String workLocation;//City
//Constructors
public EmployeeInfo(int eN, String fN, String lN, double dR, String g, String wL){
employeeNumber = eN;
firstName = fN;
lastName = lN;
deductionRate = dR;
gender = g;
workLocation = wL;
}
public EmployeeInfo(int eN) {
employeeNumber = eN;
firstName = "a";
lastName = "z";
deductionRate = 0;
gender = "a";
workLocation = "na";
}
public EmployeeInfo(int eN, String fN, String lN){
employeeNumber = eN;
firstName = fN;
lastName = lN;
deductionRate = 0;
gender = "a";
workLocation = "na";
}
//METHODS
//GETTERS AND SETTERS
public int getEmployeeNumber() {
return(employeeNumber);
}
public String getFirstName() {
return(firstName);
}
public String getLastName() {
return(lastName);
}
public double getDeductionRate() {
return(deductionRate);
}
public String getGender(){
return(gender);
}
public String getWorkLocation(){
return(workLocation);
}
public void setWorkLocation(String newWorkLocation){
workLocation = newWorkLocation;
}
public void addEmployeeAttributesTo2DArray(Object[][] attributeArray, int employeeNumInArray){
attributeArray[employeeNumInArray][0] = employeeNumber;
attributeArray[employeeNumInArray][1] = lastName;
attributeArray[employeeNumInArray][2] = firstName;
attributeArray[employeeNumInArray][3] = gender;
attributeArray[employeeNumInArray][4] = workLocation;
if(this instanceof FTEmp){
attributeArray[employeeNumInArray][5] = "Full Time";
attributeArray[employeeNumInArray][6] = ((FTEmp)this).calcAnnualGrossIncome();
}
else{//Instance of PTEmp
attributeArray[employeeNumInArray][5] = "Part Time";
attributeArray[employeeNumInArray][6] = ((PTEmp)this).calcAnnualGrossIncome();
}
}
}