first commit

This commit is contained in:
DrChic0 committed 2024-03-07 11:19:37 -08:00
commit 1e19e7f773
7 files changed
+173

No files matched your search

+22
View File
@@ -0,0 +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;
}
}