Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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