forked from fjricci/monopoly
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaxes.java
More file actions
80 lines (64 loc) · 1.35 KB
/
Taxes.java
File metadata and controls
80 lines (64 loc) · 1.35 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
package monopoly;
public class Taxes implements Square {
private final int fixTax; //fixed tax cost
private final double varTax; //percentage tax rate for variable tax
private final String name;
private final int pos;
//constructor if no variable tax option
public Taxes(int pos, boolean income) {
if (income) {
fixTax = 200;
varTax = 10;
this.name = "Income Tax";
} else {
fixTax = 75;
varTax = 0;
this.name = "Luxury Tax";
}
this.pos = pos;
}
public boolean isOwned() {
return false;
}
public int mortgage() {
return 0;
}
public int position() {
return pos;
}
public String name() {
return name;
}
public boolean isOwnable() {
return false;
}
public boolean isMortgaged() {
return false;
}
public int mortgageCost() {
return 0;
}
//return fixed rate tax owed
public int tax() {
return fixTax;
}
//return variable tax owed, based on value of player's assets
public int tax(int value) {
//if no variable tax option, return fixed tax value
if (varTax == 0)
return fixTax;
double percent = varTax / 100;
return (int) (value * percent);
}
public int cost() {
return 0;
}
public void purchase(Player player) {
}
public int rent(int val) {
return 0;
}
public Player owner() {
return null;
}
}