forked from Santoshrt999/Java-Abstract-Class-and-Interface
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbstractStoreEmployee.java
More file actions
189 lines (169 loc) · 5.32 KB
/
AbstractStoreEmployee.java
File metadata and controls
189 lines (169 loc) · 5.32 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/*
* 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.
*/
package store;
/**
* This is the AbstractStoreEmployee abstract class file implements Employee and
* Sore.
*
* @author Goteti Santosh Ravi Teja
*/
public abstract class AbstractStoreEmployee implements Employee, Store {
private double basePay;
String employeeName;
private double hourlyRate;
private double numberOfHoursWorked;
private String storeDetails;
/**
* This is an argument constructor which initializes all the instance
* variables
*
* @param numberOfHoursWorked - The parameter Number of hours worked is
* passed.
* @param hourlyRate - The parameter Hourly rate of the Employee in dollars
* is passed.
* @param storeDetails - The parameter Details of the Store is passed.
* @param basePay - The parameter Base pay of the Employee in dollars is
* passed.
* @param employeeName - The parameter Full name of the Employee is passed.
*/
public AbstractStoreEmployee(double numberOfHoursWorked, double hourlyRate, String storeDetails,
double basePay, String employeeName) {
this.numberOfHoursWorked = numberOfHoursWorked;
this.hourlyRate = hourlyRate;
this.storeDetails = storeDetails;
this.basePay = basePay;
this.employeeName = employeeName;
}
/**
* Calculates the total commission of the employee.
*
* @return- This method returns the total commission
*/
@Override
public double calculateCommission() {
return 0;
}
/**
* Calculates pay
*
* @return- This method returns calculatePay.
*/
@Override
public abstract double calculatePay();
/**
* Calculates the store revenue and returns the store revenue
*
* @param storeSales- The Parameter storeSales is passed.
* @return- This method returns Store revenue
*/
@Override
public double calculateRemainingStoreRevenue(double storeSales) {
double employeePay = calculatePay();
double storeRevenue = 0;
storeRevenue = storeSales * (1 - TAX) - employeePay;
if (storeSales > 255000) {
storeRevenue = (1 - 0.05) * storeRevenue;
} else if (storeSales > 155000 && storeSales <= 255000) {
storeRevenue = (1 - 0.03) * storeRevenue;
} else {
storeRevenue = (1 - 0.01) * storeRevenue;
}
return storeRevenue;
}
/**
* Checks if the employee should be awarded with promotion
*
* @return - This method returns the eligibility status for promotion for an
* employee.
*/
@Override
public abstract boolean checkPromotionEligibility();
/**
* Returns the base pay of the employee
*
* @return This method returns Base pay amount.
*/
public double getBasePay() {
return basePay;
}
/**
* Sets the Base pay
*
* @param basePay - The Parameter Base pay value is passed.
*/
public void setBasePay(double basePay) {
this.basePay = basePay;
}
/**
* Returns the Name of the Employee
*
* @return- This method returns String Employee name.
*/
public String getEmployeeName() {
return employeeName;
}
/**
* Sets the Employee name
*
* @param employeeName Name of the Employee
*/
public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
}
/**
* Returns hourly rate for the employee
*
* @return - This method returns Hourly rate.
*/
public double getHourlyRate() {
return hourlyRate;
}
/**
* Sets the hourly rate
*
* @param hourlyRate - The parameter Hourly rate is passed.
*/
public void setHourlyRate(double hourlyRate) {
this.hourlyRate = hourlyRate;
}
/**
* Returns number of hours worked hours
*
* @return- This method returns number of hours worked
*/
public double getNumberOfHoursWorked() {
return numberOfHoursWorked;
}
/**
* Sets the number of hours worked
*
* @param numberOfHoursWorked - The parameter number of hours worked is
* passed.
*/
public void setNumberOfHoursWorked(double numberOfHoursWorked) {
this.numberOfHoursWorked = numberOfHoursWorked;
}
/**
* Sets the Store Details
*
* @param storeDetails- The parameter Details of the Store is passed.
*/
public void setStoreDetails(String storeDetails) {
this.storeDetails = storeDetails;
}
/**
* Returns private variable are separated by one space.
*
* @return- This returns string representation of Employee and Store
* details.
*/
@Override
public String toString() {
return "Store Details: " + storeDetails + "\nEmployee Name: " + employeeName
+ "\nBase Pay: $" + basePay + "\nNumber of Hours worked: " + numberOfHoursWorked + "hrs"
+ "\nPayment Rate per hour: $" + hourlyRate + "/hr\n";
}
}