-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPACFundraiser.java
More file actions
56 lines (53 loc) · 1.84 KB
/
PACFundraiser.java
File metadata and controls
56 lines (53 loc) · 1.84 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
import java.util.ArrayList;
/**
* The PACFundraiser class is used to simulate a Political Action Committees Fundraiser
* The PACFundraiser class subclass of Fundraiser
* @author Fuad Mohamoud
*/
public class PACFundraiser extends Fundraiser
{
/**
*toString method used to output specific information about the current PACFundraiser
* @return output indicating a PACFundraiser has been ran and the name of candidate running the PACFundraiser
*/
public String toString()
{
String output="This is a PAC Fundraiser for " + getCandidate().getName();
return output;
}
/**
*Default Constructor to build and empty PACFundraiser
* Default Constructor is required in order for program to run, however it not actually used.
*/
public PACFundraiser()
{
}
/**
* Full Parameter Constructor to build a PACFundraiser using the inputted parameter values provided
* @param inLoc will be used as the location of the PACFundraiser
* @param inCandidate will used as the candidate run the PACFundraiser
* @param cands will used to calculate the total amount of money in play
* @throws TooLowInPollsException is thrown PACFundraiser’s candidate has less than 1% of the total money currently in play
*/
public PACFundraiser(String inLoc, Candidate inCandidate, ArrayList<Candidate> cands) throws TooLowInPollsException
{
int totalMoney = 0;
for(Candidate current: cands)
{
totalMoney += current.getMoney();
}
if(inCandidate.getMoney() < (1.0/100)*totalMoney)
{
throw new TooLowInPollsException();
}
else
{
setLocation(inLoc);
setCandidate(inCandidate);
donors = rand.nextInt(201);
raiseMoney();
inCandidate.setMoneyMod(inCandidate.getMoneyMod()+.2);
inCandidate.setDebateMod(inCandidate.getDebateMod()+.1);
}
}
}