Question: Study the following classes: 1 . public class MyArrayList 2 . { 3 . private int size; / / Number of elements in the list
Study the following classes:
public class MyArrayList
private int size; Number of elements in the list
private clubMember data;
Create an empty list
public MyArrayList
data new clubMember;
size ;
public boolean sortListAssume code exist
public class clubMember
private String name;
private String address;
private int handicap;
public clubMember String n String a int num
name n;
address a;
weight num;
public void setNameString name
this.name name;
public String toString
returnName is name
Address is: address
Handicap is: weight
;
public class TestMyArrayList
public static void mainString args
MyArrayList GymMember list new MyArrayList GymMember ;
GymMember a new GymMember Jan"Vleiloerie ;
GymMember b new GymMember Piet"Soetdoring ;
GymMember c new GymMember Bgani"Sefatsa st ;
listadda;
listaddb;
listaddc;
listsortList
System.out.printlnlist;
The given implementation class MyArraylist does NOT support generic objects. Write down the correct version of program lines of this class in to address this problem, then Write the Java code of the appropriate method for the clubMember class to enable it to be sorted in a
GENERIC MyArrayList class. Assume that members are compared according to their handicap. and the Java code for the remove method in the MyArrayList classs.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
