QuestionQuestion

Objective:
1.Become familiar with the dynamic allocation of array storage
2.Become familiar with ArrayList

Description:
Create your myIntArrayList class that is functionally similar to the formal Java ArrayList class.

Requirements:
Your myIntArrayList should contain the following methods and characteristics:

*Should contain a default constructor myIntArrayList()
*Should contain an alternative constructor myIntArrayList(int[] anArray) that allows the user to create an initial myIntArrayList that is equivalent to an array that is passed to the constructor
◦Should contain an alternative constructor myIntArrayList(myIntArrayList anExample) that will create an intMyArrayList identical to one that is passed to it
◦Should contain an void add(int index, int value) method
◾Need to check for appropriate index. If index is outside of the array boundaries, then add at the beginning or the end
◦Should contain a int remove(int index) method
◾If the index is outside of the array boundaries, then remove the first or last element
◦ Should contain a myIntArrayList simpleSort() method that will return another myIntArrayList object with the contents of the current object sorted using an insertion sort.
◦Should contain a int get(int index) method
◾If index is out of boundary then return either the first or last element
◦Should contain an int indexOf(int value) method
◾Returns the index of the first occurance of value
◦ Should contain an boolean isEmpty() method
◦Should contain a int size() method
◦ Should contain a void clear() method that empties the myIntArryList
◦ Should contain a void print() method that prints all elements of the myIntArrayList in one row delimited by one space

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public class myIntArrayList {
public int[] array;

public myIntArrayList()
{
array = new int[0];
}

public myIntArrayList(int[] anArray)
{
array = new int[anArray.length];
for(int i = 0; i < anArray.length; i++)
array[i] = anArray[i];...

By purchasing this solution you'll be able to access the following files:
Solution.java.

50% discount

Hours
Minutes
Seconds
$40.00 $20.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats