-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaxes.java
More file actions
141 lines (110 loc) · 2.44 KB
/
Copy pathTaxes.java
File metadata and controls
141 lines (110 loc) · 2.44 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
/**
* Taxes class - class used to calculate the federal, social security and state taxes
* @author Tom Abraham
* @period #1
*/
public class Taxes {
//declare instance variables
private double hoursWorked;
private double hourlyRate;
//declare constants
final double FEDTAXRATE = 0.15;
final double SOCSECURITYRATE = 0.0765;
final double STATETAXRATE = 0.04;
/**
* constructor Taxes - initializes the hoursWorked and hourlyRate
*/
public Taxes(double hours, double rate)
{
hoursWorked = hours;
hourlyRate = rate;
}// end constructor
/**
* Accessor method to get hours worked
* @return the hours worked
*/
public double getHoursWorked()
{
return hoursWorked;
}// end method
/**
* Accessor method to get hourly rate
* @return the hourly rate
*/
public double getHourlyRate()
{
return hourlyRate;
}// end method
/**
* Accessor method to get federal tax rate
* @return the federal tax rate
*/
public double getFedTaxRate()
{
return FEDTAXRATE;
}// end method
/**
* Accessor method to get social security tax rate
* @return the social security tax rate
*/
public double getSocSecurityRate()
{
return SOCSECURITYRATE;
}// end method
/**
* Accessor method to get state tax rate
* @return the state tax rate
*/
public double getStateTaxRate()
{
return STATETAXRATE;
}// end method
/**
* Method to compute the gross pay - pay before taxes
* @return gross pay
*/
public double computeGrossPay()
{
return hoursWorked * hourlyRate;
}// end method
/**
* Method to compute the amount of federal tax
* @return federal tax
*/
public double computeFedTax()
{
return computeGrossPay() * FEDTAXRATE;
}//end method
/**
* Method to compute the amount of social security tax
* @return social security tax
*/
public double computeSocSecurity()
{
return computeGrossPay() * SOCSECURITYRATE;
}//end method
/**
* Method to compute the amount of state tax
* @return state tax
*/
public double computeStateTax()
{
return computeGrossPay() * STATETAXRATE;
}//end method
/**
* Method to compute the amount of total tax
* @return total tax
*/
private double computeTotalTax()
{
return computeFedTax() + computeSocSecurity() + computeStateTax();
}//end method
/**
* Method to compute the amount of net pay - pay after taxes
* @return net pay
*/
public double computeNetPay()
{
return computeGrossPay() - computeTotalTax();
}//end method
}