QuestionQuestion

Objective:

- Develop a better understanding of OOP

- Become familiar with arrays in Java

- Develop a familiarity with bubble sort algorithm

Description:
- Create myIntArray class, that adds more functionality to the Java arrays.

Requirements:

Your myIntArray class should contain the following methods and characteristics:
- A default constructor myIntArray() that sets the size to 10 and initial values to 0.
- An alternative constructor myIntArray(int[] anArray) that allows the user to create an initial myIntArray that is equivalent to an array that is passed to the constructor.
- An alternative constructor myIntArray(int array_size) that sets the size of the array to array_size and initial values to 0.
- An alternative constructor myIntArray(int array_size , int init_val) that sets the size of the array to array_size and initial value to init_val.
- get(index) method that returns the value of array at the given index.
- If the index is out of the boundaries then exit the program.
- set(index, value) method that sets the value of the given index.
- If the index is out of the boundaries then exit the program.
- append(myIntArray anArray) method that appends anArray to the end of the current array.
- equals(myIntArray anArray) method that checks if the content of current array is the same as anArray.
- copy(myIntArray anArray) method that copies the content of the anArray to the calling myIntArray. This copying procedure will resize the calling myIntArray if needed.
- bubbleSort() that returns a new myIntArray with elements of the current array sorted in ascending order.
- printArray() method that prints the current array.

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 myIntArray {
public int[] array;

public myIntArray()
{
array = new int[10];
for(int i = 0; i < 10; i++)
array[i] = 0;
}

public myIntArray(int[] anArray)
{
array = anArray;...
$30.00 for this solution

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