-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGovernment.java
More file actions
69 lines (51 loc) · 1.43 KB
/
Government.java
File metadata and controls
69 lines (51 loc) · 1.43 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
public class Government {
Country country;
int capital;
int debt;
long taxRevenue;
// Fiscal Instruments
double targetRate;
SpendingPlan spendingPlan;
boolean spendingPlanReady;
// Monetary Policy
// Rates
double corporateTax = 0;
public Government(Country c, double taxRate) {
country = c;
corporateTax = taxRate;
}
public void tick(long tick) {
if(tick <= 100)
{
collectTaxes(corporateTax);
} else {
collectTaxes(corporateTax);
}
performAutonomousSpending();
}
// Collect taxes
// tax last tick income
void collectTaxes(double overrideRate) {
taxRevenue = 0;
for(Company co : country.economy.companies) {
collectTaxableIncome(co.tax(overrideRate));
}
// System.out.println("Total tax revenue this quarter: " + taxRevenue);
capital += taxRevenue;
}
// takes money from individual company
void collectTaxableIncome(long added) {
taxRevenue += added;
}
// Perform spending
// reinvesting taxes
void performAutonomousSpending() {
}
// Start investments in each company
void performSpending(long totalSpend, long minBar, long maxBar) {
if(!spendingPlanReady) {
spendingPlan = new SpendingPlan(country, totalSpend, minBar, maxBar);
}
spendingPlan.start();
}
}