Question: I need help with the java project, please. Library class: Modification 1: Modify the toString method so that it sorts the listOfMembers and listOfRequests instance

I need help with the java project, please.

Library class:

Modification 1: Modify the toString method so that it sorts the listOfMembers and listOfRequests instance variables before iterating through them.

Note:

Youll do this by calling the sortArrayList method of the LibraryUtility class.

Modification 2: Write a method called addMember, which has a parameter of type Member. The method makes a copy of the parameter and adds it to the listOfMembers instance variable.

Below is the method header:

/**

* The addMember method adds a member to the library's list of members.

* @param memberObj the Member object to be added to the list.

*/

public void addMember(Member memberObj)

{

//provide implementation

}

Modification 3: Write a method called memberExists, which has a parameter of type int that represents a member id. The method iterates through the listOfMembers instance variable looking for a Member whose id is equal to the parameter. If it finds it, it returns true; otherwise, it returns false.

Below is the method header:

/**

* The memberExists method checks if a member exists with the given id.

* @param memberID ID of the member to search for.

* @return True if a member is found with the given id. False otherwise.

*/

private boolean memberExists(int memberID)

{

//provide implementation

}

Modification 4: Write a method called getMemberInfo, which has a parameter of type int that represents a member id. The method iterates through the listOfMembers instance variable looking for a Member whose id is equal to the parameter. If it finds it, it returns the string returned by the Member objects toString method; otherwise, it returns the string No member found with id: " + memberID.

Below is the method header:

/**

* The getMemberInfo method returns a string with information regarding the

* member found with the given id.

* @param memberID ID of the member to search for.

* @return A string containing member information.

*/

public String getMemberInfo(int memberID)

{

//provide implementation

}

Modification 5: Overload the getMemberInfo method. This one has a parameter of type String that represents a member last name. The method iterates through the listOfMembers instance variable looking for all Members whose lastName is equal to the parameter. It returns a string that has the information for all members found (concatenate the string returned by the toString method of each Member object found).

If no Member object is found with the given last name, the method returns the string No members found with last name: " + lName.

Below is the method header:

/**

* The getMemberInfo method returns a string with information regarding all

* members found with the given last name.

* @param lName Last name of the member(s) to search for.

* @return A string containing member(s) information.

*/

public String getMemberInfo(String lName)

{

//provide implementation

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!