Question
Cant figure out these objects out. Need to add volunteer v to an array. and then remove a volunteer. ublic class Volunteer { private String
Cant figure out these objects out. Need to add volunteer v to an array. and then remove a volunteer.
ublic class Volunteer { private String firstname; private String lastname; private String Rank; private int Points; private static int objectCount; public Volunteer(String fname, String lname) { firstname = fname; lastname = lname; objectCount = objectCount+1; } public Volunteer(String fname, String lname, String rank) { firstname = fname; lastname = lname; Rank = rank; objectCount = objectCount+1; } public Volunteer(String fname, String lname, String rank, int points) { firstname = fname; lastname = lname; Rank = rank; Points = points; objectCount = objectCount+1; }
public boolean update(int activityHours) { if(activityHours>1 && activityHours
}
The VolunteerRoster class will be used to store and report on all Volunteer objects. Therefore create an ArrayList to store Volunteer objects in this class. It must also include the following 1. public Volunteer Roster (int year, String semester) This is the only constructor, it takes the year and the semester (Fall, Summer, Spring) as arguments and updates the private instance variables so the information can be retrieved later. 2. public boolean addvolunteer (Volunteer v) Add a Volunteer object v to the roster. If the Volunteer is already in the roster, return false and do not add to roster, otherwise return true. Use the equals method you created in the Volunteer class to figure out if the Volunteer is already on the roster. 3. public boolean removeVolunteer (String fname, String lname) Remove the Volunteer with the provided first and last names. Return true if the Volunteer was found and removed, false otherwise. Use the equals method you created in the Volunteer class to figure out if the Volunteer is already on the roster. 4. public String printLastname AndRankofAll() Print to the console, all the last name and rank of all the Volunteers on the roster. The display should be nicely formatted with a header. 5. public String printvolWithMostPoints () Find and Print the first and last name, rank and points of the Volunteer with the most points. The display should be nicely formatted with a header. 6. public String printvolWithLeastPoints () Find and Print the first and last name, rank and points of the Volunteer with the least points. The display should be nicely formatted with a header. 7. Other methods should only be getter methods as follows a. public String getSemester (), public int getYear(). 8. All class variables must be privateStep 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