Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Implement the arraylist ADT as MyArrayList class implements Cloneable) with the following public methods: a. append(Object element) - appending the element at the end

image text in transcribed

1. Implement the arraylist ADT as MyArrayList class implements Cloneable) with the following public methods: a. append(Object element) - appending the element at the end of the arraylist b. clear() - make the arraylist collection empty C. contains (Object element) - check whether the arraylist contains the element d. elementat(int index) - access the element at the given index e. indexOf(Object element) - find the index of the element f. insert.At(int index, Object element) - insert the element at the given index g.isEmptyo - check whether the array list is empty h. removeAt(int index) - remove the element at the given index i. remove(Object element) - remove the element from the arraylist j. replace(int index, Object element) - replace the element at the given index with the given element k.size() - get the number of elements in the current arraylist 1. ensureCapacity (int minCapacity) - make sure the arraylist gets at least the given capacity m. clone) - returns a cloned copy of this arraylist n. removeRange(int fromIndex, int toIndex) - removes from this arraylist all of the elements whose index is between from Index, inclusive and toIndex, exclusive o.toString(- returns a string representation of this arraylist, containing the String representation of each element p. reverse() - reverse the elements in this arraylist 4. merge(MyArrayList arraylist2) - add all the elements in arraylist2 to the end of this arraylist 2. The MyArrayList class should be created in the collection package. 3. Your implementation should be a self-expanding arraylist, and behave like what we discussed in class. 4. After implementing the MyArrayList class you will test your MyArrayList class. To test the MyArrayList class you will create a Lab2 class under the lab package. 5. In the Lab2 class you will do the following: a. Search to find out what is the Fibonacci number sequence b. create a static method named test and do the following in this method i. create an instance of MyArrayList ii. add the first 25 Fibonacci numbers (starts with 0. 1. 1. 2. 3,5. 8. ...) into the arraylist based on the Fibonacci function, (not manually one by one, but by using a loop) 1. Implement the arraylist ADT as MyArrayList class implements Cloneable) with the following public methods: a. append(Object element) - appending the element at the end of the arraylist b. clear() - make the arraylist collection empty C. contains (Object element) - check whether the arraylist contains the element d. elementat(int index) - access the element at the given index e. indexOf(Object element) - find the index of the element f. insert.At(int index, Object element) - insert the element at the given index g.isEmptyo - check whether the array list is empty h. removeAt(int index) - remove the element at the given index i. remove(Object element) - remove the element from the arraylist j. replace(int index, Object element) - replace the element at the given index with the given element k.size() - get the number of elements in the current arraylist 1. ensureCapacity (int minCapacity) - make sure the arraylist gets at least the given capacity m. clone) - returns a cloned copy of this arraylist n. removeRange(int fromIndex, int toIndex) - removes from this arraylist all of the elements whose index is between from Index, inclusive and toIndex, exclusive o.toString(- returns a string representation of this arraylist, containing the String representation of each element p. reverse() - reverse the elements in this arraylist 4. merge(MyArrayList arraylist2) - add all the elements in arraylist2 to the end of this arraylist 2. The MyArrayList class should be created in the collection package. 3. Your implementation should be a self-expanding arraylist, and behave like what we discussed in class. 4. After implementing the MyArrayList class you will test your MyArrayList class. To test the MyArrayList class you will create a Lab2 class under the lab package. 5. In the Lab2 class you will do the following: a. Search to find out what is the Fibonacci number sequence b. create a static method named test and do the following in this method i. create an instance of MyArrayList ii. add the first 25 Fibonacci numbers (starts with 0. 1. 1. 2. 3,5. 8. ...) into the arraylist based on the Fibonacci function, (not manually one by one, but by using a loop)

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

Step: 3

blur-text-image

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

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

Did the team members feel that their work mattered

Answered: 1 week ago

Question

3. What may be the goal of the team?

Answered: 1 week ago