Question: Can someone import all this code into a project and find out why the code doesn't work. All I need is someone to fix the
Can someone import all this code into a project and find out why the code doesn't work. All I need is someone to fix the code and get an output from the client class. (Should be a table) Please send back all the updated codes from the classes when done. (Sorry they are screenshots, Chegg won't let me paste all text) Thank you

====
Client class:
public class Client {
public static void main(String[] args) { long[][] resultsArray = new long[8][3]; long[][] resultsLinked = new long[8][3];
int row = 0;
for (int n = 10; n arrayBag = new ArrayBag(n); LinkedBag
long start, stop, elapsed;
// Timing test for ArrayBag start = System.currentTimeMillis(); for (int i = 0; i
// Timing test for LinkedBag start = System.currentTimeMillis(); for (int i = 0; i
row++; }
// Print results for ArrayBag System.out.println("ArrayBag:"); print2dAsciiTable(resultsArray);
// Print results for LinkedBag System.out.println("LinkedBag:"); print2dAsciiTable(resultsLinked); }
/** * Prints a 2-dimensional array of long in a nicely formatted ASCII table. * @param data the data to print */ public static void print2dAsciiTable(long[][] data) { System.out.println("+----------------------+---------------+---------------+"); System.out.println("| N | Add Time (ms) | Remove Time (ms) |"); System.out.println("+----------------------+---------------+---------------+"); for (int row = 0; row
}
==========
ArrayBag.java
public class ArrayBag
public ArrayBag() { this(DEFAULT_CAPACITY); }
@SuppressWarnings("unchecked") public ArrayBag(int initialCapacity) { numberOfEntries = 0; list = (E[]) new Object[initialCapacity]; }
public int getCurrentSize() { return numberOfEntries; }
@Override public boolean isEmpty() { return numberOfEntries == 0; }
@Override public void add(E newEntry) { if (numberOfEntries == list.length) { list = Arrays.copyOf(list, 2 * list.length); } list[numberOfEntries++] = newEntry; }
public void addTest(E newEntry) { if (numberOfEntries == list.length) { list = Arrays.copyOf(list, 2 * list.length); } list[numberOfEntries] = newEntry; numberOfEntries++; }
public E removeTest() { if (isEmpty()) { return null; } else { E removedEntry = list[numberOfEntries - 1]; list[numberOfEntries - 1] = null; numberOfEntries--; return removedEntry; } }
@Override public E remove() { return removeTest(); } }
=====
LinkedBag class
public class LinkedBag
public LinkedBag() { firstNode = null; numberOfEntries = 0; }
public int getCurrentSize() { return numberOfEntries; }
@Override public boolean isEmpty() { return numberOfEntries == 0; }
@Override public void add(E newEntry) { Node
public void addTest(E newEntry) { Node
public E removeTest() { if (isEmpty()) { return null; } else { E removedEntry = firstNode.data; firstNode = firstNode.next; numberOfEntries--; return removedEntry; } }
@Override public E remove() { return removeTest(); }
private class Node
private Node(T dataPortion) { this(dataPortion, null); }
private Node(T dataPortion, Node
========
Bag interface

=======
SinglyLinkedList class



ArrayBag.java Bag.java Client.java LinkedBag.java SinglyLinkedList.java blic interface Bag
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
