Menu

Public Class Arrayclass Extends Javalangobject Description Class Wrapper Java Array Additi Q43895101

public class ArrayClass

extends java.lang.Object

Description: Class wrapper for a Java array, with additionalmanagement operations

Note: Maintains a capacity value for maximum number of itemsthat can be stored, and a size value for the number of valid orviable data items in the array

Implement the followings in ArrayClass:

Fields

private int

arrayCapacity

private int

arraySize

private static int

DEFAULT_CAPACITY

static int

FAILED_ACCESS

private int[]

localArray

Constructors

Constructor and Description

ArrayClass()

Default constructor, initializes array to default capacity(10)

ArrayClass(ArrayClasscopied)

Copy constructor, initializes array to size and capacity ofcopied array, then copies only the elements up to the givensize

ArrayClass(int capacity)

Initializing constructor, initializes array to specifiedcapacity

ArrayClass(int capacity, int size, intfillValue)

Initializing constructor, initializes array to specifiedcapacity, size to specified value, then fills all elements withspecified size value

Method Summary

All MethodsInstance MethodsConcreteMethods

Modifier and Type

Method and Description

int

accessItemAt(int accessIndex)

Accesses item in array at specified index if index within arraysize bounds

boolean

appendItem(int newValue)

Appends item to end of array, if array is not full, e.g., nomore values can be added

void

clear()

Clears array of all valid values by setting array size to zero,values remain in array but are not accessible

int

getCurrentCapacity()

Description: Gets current capacity of array

int

getCurrentSize()

Description: Gets current size of array

boolean

insertItemAt(int insertIndex, int newValue)

Description: Inserts item to array at specified index if arrayis not full, e.g., no more values can be added

boolean

isEmpty()

Tests for size of array equal to zero, no valid values stored inarray

boolean

isFull()

Tests for size of array equal to capacity, no more values can beadded

int

removeItemAt(int removeIndex)

Description: Removes item from array at specified index if indexwithin array size bounds

boolean

resize(int newCapacity)

Description: Resets array capacity, copies current size andcurrent size number of elements

Expert Answer


Answer to public class ArrayClass extends java.lang.Object Description: Class wrapper for a Java array, with additional management…

OR