-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFundraiser.java
More file actions
41 lines (31 loc) · 911 Bytes
/
Fundraiser.java
File metadata and controls
41 lines (31 loc) · 911 Bytes
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
public class Fundraiser implements Comparable<Fundraiser>, java.io.Serializable {
/**
*The person's full name.
**/
private String name;
/**
*The total amount of money that this person has raised so far.
**/
private double moneyRaised;
public Fundraiser (String nameIn) {
name = nameIn;
moneyRaised = 0.0;
}
public String getName() { return name; }
public void setName (String nameIn) {
name = nameIn;
}
public double getMoneyRaised() { return moneyRaised; }
public void addFundraisingMoney(double moneyIn) {
moneyRaised += moneyIn;
}
public void clearFundraisingTally() {
moneyRaised = 0.0;
}
public int compareTo(Fundraiser other) {
int result = 0;
if (moneyRaised < other.moneyRaised) { result = -1; }
else if (moneyRaised > other.moneyRaised) { result = 1; }
return result;
}
}