Question
IN JAVA complete where it says TODO : AND THE DONOR CLASS IS IN THIS LINK ( https://s2.postimg.org/nmuej2ze1/donor_class.png) import java.util.ArrayList; public class Campaign {
IN JAVA complete where it says " TODO" :
AND THE DONOR CLASS IS IN THIS LINK ( https://s2.postimg.org/nmuej2ze1/donor_class.png)
import java.util.ArrayList;
public class Campaign {
private String candidateName;
private ArrayList donors;
public Campaign(String name)
{
//TODO Initialize all of the instance data
}
public String getCandidateName()
{
//TODO Complete the accessor
return null; // stub
}
public String getDonors()
{
String result = candidateName + " ";
result += donors.toString();
return result;
}
public double getAllDonations()
{
double sum = 0.0;
for (int i=0; i
{
Donor d = donors.get(i);
sum += d.getTotalDonations();
}
return sum;
}
public void addDonor(String name)
{
// TODO Check that there is not a donor by this name already
// TODO If we get here this donor does not exist--add them in
}
public double getDonation(String donor)
{
//TODO Complete this method
return 0.0; // stub
}
public String getDonationList(String donor)
{
for (int i=0; i
{
Donor d = donors.get(i);
if (d.getName().equals(donor))
{
return d.toString();
}
}
return "No donor with that name was found";
}
public void addDonation(String donorName, double donation)
{
// TODO Complete this method
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started