-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaxSpace.java
More file actions
66 lines (58 loc) · 2.6 KB
/
Copy pathTaxSpace.java
File metadata and controls
66 lines (58 loc) · 2.6 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
/*
* This class processes the tax spaces. Income tax space and luxury functions
* are located in this class.
*/
package project_3;
import javax.swing.JOptionPane;
/**
*
* @author Rohan Khante, Matthew Wentz, Jonathan Sorem, Robert James Davis
*/
public class TaxSpace {
int choiceSelection = 0;
boolean isValid = false;
Money processMoney = new Money();
void incomeTax(Player currentActivePlayer)
{
choiceSelection = Integer.parseInt(JOptionPane.showInputDialog("You landed on the Income Tax. Please choose one of the following options:\n"
+ "1) Pay 10% of your remaining cash.\n"
+ "2) Pay $200\n"));
if(currentActivePlayer.totalCash < 200)
{
JOptionPane.showMessageDialog(null, "You do not have $200, so you will pay %10.\n", "Buy Property Decision.", 1);
choiceSelection = 1;
}
while(isValid == false)
{
switch(choiceSelection)
{
case 1:
JOptionPane.showMessageDialog(null, "You will pay 10% of your total cash. which is " + currentActivePlayer.totalCash/10 + ".\n", "Income Tax 10%.", 1);
processMoney.moneyOwedByPlayer(currentActivePlayer.totalCash/10, currentActivePlayer);
isValid = true;
break;
case 2:
JOptionPane.showMessageDialog(null, "You decided to pay $200.\n", "Income Tax", 1);
processMoney.moneyOwedByPlayer(200, currentActivePlayer);
isValid = true;
break;
default:
JOptionPane.showMessageDialog(null, "You need to make a valid selection in order to continue.\n", "Invalid Decision.", 1);
}
}
}
void luxuryTax(Player currentActivePlayer)
{
JOptionPane.showMessageDialog(null, "You landed on the Luxury Tax Space.\n", "Luxury Tax", 1);
if(currentActivePlayer.totalCash > 74)
{
JOptionPane.showMessageDialog(null, "You will pay $75.\n", "Luxury Tax", 1);
processMoney.moneyOwedByPlayer(200, currentActivePlayer);
}
else
{
JOptionPane.showMessageDialog(null, "You only had " + currentActivePlayer.totalCash + "So you will pay all of it.\n", "Luxury Tax", 1);
currentActivePlayer.totalCash = 0;
}
}
}