CS174: OOP - Drills - Array Insert

Developed by Professor Tralie and Professor Mongan.


Exercise Goals

The goals of this exercise are:
  1. To do proper array indexing
  2. To use loops in concert with arrays
  3. To allocate and populate new arrays
Modify the insertElement method in ArrayUtils.java to insert an element at a particular index. For example, if you have the array {0, 5, 4, 8, 2} and you insert the element 1 at index 2, you should create a new array with the elements {0, 5, 1, 4, 8, 2}.

NOTE: The tediousness of this seemingly simple operation is what motivates us to use other data structures such as an ArrayList or linked list.

Welcome to our online modules system! Be sure to log in with your Urinus ID before you proceed. For example, Professor Tralie's ID is ctralie. If you are not an Ursinus student, that's fine! Just make something up, and you can still run everything