Lab Assignment 5A Write a class with one attribute, an integer array. Your constructor should take an integer array as its only parameter. Write all the accessors, mutators, toString and equals methods. Also write an additional RECURSIVE method that returns the sum of all the elements in the array (your method should have an array as it's argument and should have the recursive call in its return for the general case). Write a client class to test all your methods and especially your recursive method. Remember to submit all your .java files, .class files and screenshots of your code and output.

Respuesta :

Answer:

See attached file.

Explanation:

import java.util.Arrays;

public class ArrayObject {

 

private int[] arr;

 

public ArrayObject(int[] arr)

{

this.arr = arr;

}

 

public int[] getArray()

{

return this.arr;

}

.

.

.

.

See attached file for complete code.

Ver imagen abdullahfarooqi
ACCESS MORE