Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Cant figure out these objects out. Need to add volunteer v to an array. and then remove a volunteer. ublic class Volunteer { private String

image text in transcribed

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 private

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions