-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCandidate.java
More file actions
99 lines (88 loc) · 1.85 KB
/
Candidate.java
File metadata and controls
99 lines (88 loc) · 1.85 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/**
* Fuad Mohamoud
* Computer Science II
* 01/29/2106
*/
import java.util.Random;
public class Candidate
{
private String name = "DEFAULT";
private String slogan = "DEFAULT";
private int money;
private String party = "DEFAULT";
private Random rand = new Random();
/**
* Candidate constructor takes in name, slogan, and party affiliation.
*/
public Candidate(String inName, String inSlogan, String inParty)
{
setName(inName);
setSlogan(inSlogan);
setParty(inParty);
money = rand.nextInt(101);
}
/**
* Sets Name
*/
public void setName(String inName)
{
name = inName;
}
/**
* gets name
*/
public String getName()
{
return name;
}
/**
* Sets slogan
*/
public void setSlogan(String inSlogan)
{
slogan = inSlogan;
}
/**
* Returns Slogan
*/
public String getSlogan()
{
return slogan;
}
/**
* Sets party
*/
public void setParty(String inParty)
{
party = inParty;
}
/**
* returns party
*/
public String getParty()
{
return party;
}
/**
* returns random money set for each candidate
* in constructor.
*/
public int getMoney()
{
return money;
}
/**
* Adding Money method, which is needed for debates and Fundraisers later
*/
public void addMoney(int newMoney)
{
money += newMoney;
}
/**
* Returns a String with Candidates name and a Endorsement Message.
*/
public String endorse()
{
return "My name is " + getName() + " and I approve this message";
}
}