public class DynamicArray {

  private int size;
  private int capacity;
  private int resizeFactor;
  private int[] growingArray;

  public DynamicArray(int capacity, int resizeFactor) {
    this.size = 0;
    this.capacity = capacity;
    this.resizeFactor = 0;
    this.growingArray = new int[size];
  }

  /* Copy the elements of the current array into a larger array.
     Return the new larger array. */
  private int[] resizeAndFillArray() {
    int newCapacity = capacity * resizeFactor;
    int[] grownArray = new int[newCapacity];
    for (int i = 0; i < this.size; ++i) {
      grownArray[i] = this.growingArray[i];
    }
    this.capacity = newCapacity;
    return grownArray;
  }

  /* Insert a new item into the array. */
  protected void insert(int item) {
    /* The current array is full, resize it. */
    if (this.size == this.capacity) {
      this.growingArray = resizeAndFillArray();
    }
    this.growingArray[size] = item;
    this.size++;
    return;
  }

  /* Remove the item at index from the array. */
  protected int remove(int index) {
    int removed = this.growingArray[index];
    this.growingArray[index] = -1;
    this.size--;
    return removed;
  }

  /* Return the number of elements in the dynamic array. */
  protected int getSize() {
    return this.size;
  }

  /* Return the capacity for the dynamic array. */
  protected int getCapacity() {
    return this.capacity;
  }

  /* Return the resize factor for the dynamic array. */
  protected int getResizeFactor() {
    return this.resizeFactor;
  }

  /* Update the resize factor for the dynamic array. */
  protected void setResizeFactor(int newFactor) {
    this.resizeFactor = newFactor;
  }

}

@@ -254,17 +254,28 @@
 actor = 
-0
+resizeFactor
 ;%0A    th
@@ -300,20 +300,24 @@
 new int%5B
-size
+capacity
 %5D;%0A  %7D%0A%0A
@@ -942,20 +942,27 @@
 ngArray%5B
+this.
 size
+++
 %5D = item
@@ -967,25 +967,8 @@
 em;%0A
-    this.size++;%0A
     
@@ -1144,24 +1144,26 @@
 %5D = -1;%0A    
+--
 this.size--;
@@ -1159,18 +1159,16 @@
 his.size
---
 ;%0A    re
@@ -1640,32 +1640,32 @@
 nt newFactor) %7B%0A
-
     this.resizeF
@@ -1688,10 +1688,172 @@
 r;%0A  %7D%0A%0A
+  protected void show() %7B%0A    for(int i = 0; i %3C this.size; ++i) %7B%0A      System.out.println(%22Array at index %5B%22 + i + %22%5D is: %22 + this.growingArray%5Bi%5D);%0A    %7D%0A  %7D%0A%0A
 %7D%0A

Add method to display dynamic array. Pass dynamic growth test cases.