- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTax.java
More file actions
Latest commit
28 lines (25 loc) · 702 Bytes
/
Copy pathTax.java
File metadata and controls
28 lines (25 loc) · 702 Bytes
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
classTax {
doublegrossIncome; // class member variables
Stringstate;
intdependents;
// First Constructor
Tax (doublegrossIncome, Stringstate, intdependents){
this.grossIncome = grossIncome; // instance variable initialization
this.state = state;
this.dependents=dependents;
}
// Second Constructor
Tax (doublegrossIncome, intdependents){
this(grossIncome, "NY", dependents);
}
publicdoublecalcTax() {
doublestateTax=0;
if (grossIncome < 30000) {
stateTax=grossIncome*0.05;
}
else{
stateTax= grossIncome*0.06;
}
returnstateTax;
}
}