Question: Generic Class Exercise 2 In the lecture (unit1), we implement the concept of waiting list of generic type using an array. 1- Now, we want

Generic Class Exercise 2 In the lecture (unit1), we implement the concept of waiting list of generic type using an array.

1- Now, we want to implement the concept (as generic ) using ArrayList. Your generic WaitingList class should include the following method:

a- add: it receives generic type elements and add it to the end of the list.

b- get: it receives an index and returns the element at the specific index (if there is ), or null if there is no such index.

c- remove: it removes the first element, and returns that element.

d- print: it prints the elements in the waiting list. Create class GC_Test, that has main method. In the main,

a- Create WaitingList of Car, and add three cars.

b- Test method remove, reverse , and print the list after each method to test the methods.

c- Create WaitingList of Student, and add four students.

d- Test method remove, reverse , and print the list after each method to test the methods.

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!