Constructor, instantiates the two arrays with the given size as a parameter. Sets the private lengths equal to zero since the arrays are initially empty. The constructor should not print or read anything

computer science

Description

ArrayPair: Constructor, instantiates the two arrays with the given size as a parameter. Sets the private lengths equal to zero since the arrays are initially empty. The constructor should not print or read anything


add: Adds the given value to the right end of the array specified by the arrNumber (if equal to 1, adds to the arr1, if 2 adds to arr2, otherwise prints an error message and does not add the value). add should not print anything other than the error message when appropriate.


remove: Removes the rightmost element of the array specified by arrNumber. If the array is empty, an error message should be printed. remove should not print anything other than an error message when appropriate.


equal: Returns true if the two arrays have the same number of values and the exact same values in the same order. Otherwise, equal should return false. equal should not print anything to output


Related Questions in computer science category