Question: I need help with Bulletproofing Language: Java Thank you! Page of lab Lab 2 - Bulletproofing In both BigIntArrayList and NumericObjectArrayList, improve the functionality of

 I need help with Bulletproofing Language: Java Thank you! Page of

lab Lab 2 - Bulletproofing In both BigIntArrayList and NumericObjectArrayList, improve the

functionality of methods by preventing the methods from throwing an exception or

returning an invalid number if an index is out of range: .insert(index,

value) - just return if index out of range deleteAt(index) and getValueAt(index)

- return Long.MIN_VALUE or null if index out of range for BigIntArrayList

or NumericObjectArrayList respectively Update JUnit tests to show that these are working

I need help with Bulletproofing

Language: Java

Thank you!

Page of lab Lab 2 - Bulletproofing In both BigIntArrayList and NumericObjectArrayList, improve the functionality of methods by preventing the methods from throwing an exception or returning an invalid number if an index is out of range: .insert(index, value) - just return if index out of range deleteAt(index) and getValueAt(index) - return Long.MIN_VALUE or null if index out of range for BigIntArrayList or NumericObjectArrayList respectively Update JUnit tests to show that these are working properly Start Page * IfStatments.java x Source History E .-197 * @version 1.0 Complex.java x Money.java x 9 PBB O TestBigFloatArrayList.java N- class BigIntArrayList { //fields private long[] list; private int count; * Constructor. Initializes the underlying array to 10 elements. BigIntArrayList() { list = new long[10]; count = 0; * Inserts the given long value at the given index. The index is * assumed to be a value between 0 and count. Existing elements * are moved up as needed to make room for the new value. * @param index the index where the new value should be stored * @param value the value to be stored public void insert(int index, long value) { if (count index; i--) { list[i] = list[i-1]; list[index] = value; } else { long[] copy = new long (3 * list.length]; for (int i = 0; i insert > if (count any empty spaces in the array * @param index the index of the element that should be removed * @return the value that was removed public long deleteAt (int index) { long removed = list[index]; for (int i = index +l; i O insert > if (count JULI uy II JUCIL.Juvu COMPILA.Juvu A TOILY.Juvu TuDiyi UUTULIUL.Juvu Source History CB- FAQ PBB W 102 public int locate (long value) { for (int i = 0; i 0) { output = output.substring(0, output.length() - 2); } else { output = output.substring(0, output.length() - 1); output += " "; return output; package numberlist.objectlist; public class NumericObjectArrayList { // fields private int count; private Object[] list; * Constructor. Initializes the underlying array to 10 elements. public NumericObjectArrayList() { list = new Object[10]; count = 0; * Inserts the given long value at the given index. The index is * assumed to be a value between 0 and count. Existing elements * are moved up as needed to make room for the new value. * @param index the index where the new value should be stored * @param value the value to be stored public void insert(int index, Object obj) { if (count index; i--) { list[i] = list[i - 1]; list[index] = obj; else { Object[] copy = new Object (3 * list.length]; for (int i = 0; i 0) { output = output.substring(0, output. length() - 2); } else { output = output.substring(0, output.length() - 1); output += "; return output; Page of lab Lab 2 - Bulletproofing In both BigIntArrayList and NumericObjectArrayList, improve the functionality of methods by preventing the methods from throwing an exception or returning an invalid number if an index is out of range: .insert(index, value) - just return if index out of range deleteAt(index) and getValueAt(index) - return Long.MIN_VALUE or null if index out of range for BigIntArrayList or NumericObjectArrayList respectively Update JUnit tests to show that these are working properly Start Page * IfStatments.java x Source History E .-197 * @version 1.0 Complex.java x Money.java x 9 PBB O TestBigFloatArrayList.java N- class BigIntArrayList { //fields private long[] list; private int count; * Constructor. Initializes the underlying array to 10 elements. BigIntArrayList() { list = new long[10]; count = 0; * Inserts the given long value at the given index. The index is * assumed to be a value between 0 and count. Existing elements * are moved up as needed to make room for the new value. * @param index the index where the new value should be stored * @param value the value to be stored public void insert(int index, long value) { if (count index; i--) { list[i] = list[i-1]; list[index] = value; } else { long[] copy = new long (3 * list.length]; for (int i = 0; i insert > if (count any empty spaces in the array * @param index the index of the element that should be removed * @return the value that was removed public long deleteAt (int index) { long removed = list[index]; for (int i = index +l; i O insert > if (count JULI uy II JUCIL.Juvu COMPILA.Juvu A TOILY.Juvu TuDiyi UUTULIUL.Juvu Source History CB- FAQ PBB W 102 public int locate (long value) { for (int i = 0; i 0) { output = output.substring(0, output.length() - 2); } else { output = output.substring(0, output.length() - 1); output += " "; return output; package numberlist.objectlist; public class NumericObjectArrayList { // fields private int count; private Object[] list; * Constructor. Initializes the underlying array to 10 elements. public NumericObjectArrayList() { list = new Object[10]; count = 0; * Inserts the given long value at the given index. The index is * assumed to be a value between 0 and count. Existing elements * are moved up as needed to make room for the new value. * @param index the index where the new value should be stored * @param value the value to be stored public void insert(int index, Object obj) { if (count index; i--) { list[i] = list[i - 1]; list[index] = obj; else { Object[] copy = new Object (3 * list.length]; for (int i = 0; i 0) { output = output.substring(0, output. length() - 2); } else { output = output.substring(0, output.length() - 1); output += "; return output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!