Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. GIVEN THE CLASS BELOW, DESIGN A METHOD TO REVERSE THE ORDER OF MEMBERS IN THE

ID: 3611146 • Letter: 1

Question

1. GIVEN THE CLASS BELOW, DESIGN A METHOD TO REVERSE THE ORDER
OF MEMBERS IN THE ARRAY.

public class ArrayClass
{
   private int[] data;
   private int size;
   private int capacity;

    :
    :
}


2. GIVEN THE CLASS IN QUESTION 1, DESIGN A METHOD TO PERFORM AMULTI-
OCCURRENCE SEARCH.


3. BRIEFLY EXPLAIN HOW AN EXCEPTION WORKS.


4. GIVE AN EXAMPLE TO DEMONSTRATE HOW POLYMORPHISM WORKS.

5. GIVEN THE CLASS BELOW, DESIGN THE METHOD "expand",
WHICH DYNAMICALLY EXPANDS THE CAPACITY OF THE ARRAY
"data" BY 10 SPACES. (USE OF VECTORS NOT ALLOWED)

public class AnArray
{
private Integer[ ] data;
private int capacity;
private int size;

public void expand ( );
:
:
}


6. DESIGN A METHOD TO EMULATE "compareTo" in "String"
CLASS.



7. GIVEN THE CLASS BELOW, DESIGN THE METHOD "expand",
WHICH DYNAMICALLY EXPANDS THE CAPACITY OF THE ARRAY
"data" BY 10 SPACES. (USE OF VECTORS NOT ALLOWED)

public class AnArray
{
private Integer[ ] data;
private int capacity;
private int size;

public void expand ( );
:
:
}


8. GIVE A SPECIFIC EXAMPLE TO EXPLAIN HOW TO REPRESENT
2-DIMENSIONAL DATA IN 1-DIMENSIONAL.























Explanation / Answer

class AnArray{private int[ ] data;private int capacity;private int size;public void reverse(){int i,temp;for(i=0;i