Archived
Add files via upload
This commit is contained in:
1 parent
1e19e7f773
commit
943f152ce6
12 files changed
+377
-170
No files matched your search
+22
-22
@@ -1,22 +1,22 @@
|
||||
public class Fundraiser {
|
||||
private double target;
|
||||
private double total;
|
||||
private double count = 0;
|
||||
|
||||
public Fundraiser(double amount) {
|
||||
total = amount;
|
||||
}
|
||||
|
||||
public double averageDonation() {
|
||||
return (count == 0) ? 0.0 : total / count;
|
||||
}
|
||||
|
||||
public void addDonation(double amount) {
|
||||
total += amount;
|
||||
count++;
|
||||
}
|
||||
|
||||
public double distanceToTarget() {
|
||||
return (total >= target) ? 0.0 : target - total;
|
||||
}
|
||||
}
|
||||
public class Fundraiser {
|
||||
private double target;
|
||||
private double total;
|
||||
private double count = 0;
|
||||
|
||||
public Fundraiser(double amount) {
|
||||
total = amount;
|
||||
}
|
||||
|
||||
public double averageDonation() {
|
||||
return (count == 0) ? 0.0 : total / count;
|
||||
}
|
||||
|
||||
public void addDonation(double amount) {
|
||||
total += amount;
|
||||
count++;
|
||||
}
|
||||
|
||||
public double distanceToTarget() {
|
||||
return (total >= target) ? 0.0 : target - total;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user