Starting from:
$35

$29

HomeWork #3 Solution

Source Code







The only Java class provided in the zip file attached to this Dropbox assignment is




ArrayList.java




Furthermore, in this coding problem the same List interface provided in HW#2 (i.e. the SinglyLinkedList assignment) will be used, and under no circumstances are you allowed to modify or create a newList interface. You must List interface as is.




You may only modifythe ArrayList class.In particular, in the ArrayList class you may only modify the methods listed in Part 1, and under no circumstances are you allowed to remove, add, or modify any other line of code in this class (this include instance variables, class variables, constants, etc.).




Lastly, you may not change the package structure! Specifically, edu.cofc.csci230 cannot be removed or modified. If a solution is submitted with a different package structure, it will not be graded, no exceptions.




Part 1







In the ArrayList class please fully implement the methods listed below:




 
public void add(int index, AnyType t) throws IndexOutOfBoundsException




 
public void set(int index, AnyType t) throws IndexOutOfBoundsException

 
public AnyType remove( int index ) throws IndexOutOfBoundsException

 
public AnyType get(int index) throws IndexOutOfBoundsException




 
public void clear()




 
private void grow()




 
private void shrink()




In each method above, there is a TODO comment - this is where you add your code. Please note (and testing hint): the functionality of the methods are identical to the ones in the List interface defined in the Java API.



Part 2







The provided ArrayList class has a main method. In the main please add test cases that demonstrate you have fully evaluated the operational correctness of the methods implemented in Part 1. To receive full credit, these test cases must be included.




Submission







Create a zip file that only includes the completed ArrayList.java file (please do not




include any folders or any other project files in the zip file). If you have any questions about the submission policy, please resolve before the due date. Lastly, please plan appropriately, asking question the day the assignment is due (within 12 hours) is too late. Please try to resolve any questions at least 2 days before the due date. The name of the zip file must be your last name. For example, ritchie.zip would be correct if the




original coy developer of UNIX (Dennis Ritchie) submitted the assignment. Only assignments submitted in the correct format will be accepted (no exceptions). Please submit the zip file (via OAKS) to the Dropbox setup for this assignment by the due date. You may resubmit the zip file as many times as you like, Dropbox will only keep the newest submission.










Grading Rubric






ArrayList Compiles
10 points




ArrayList Runs
5 points




Thoroughness of your test cases
5 points




Instructor test cases (8 cases 10 points each)
80 points






100 points










In particular, the assignment will be graded as follow, if the submitted solution




 
Does not compile: 0 of 100 points




 
Compiles but does not run: 10 of 100 points




 
Compiles and runs with no errors: 15 of 100 points




 
Thoroughness of your test cases: 20 of 100 points




 
Passes all 8 test cases developed by instructor: 100 of 100 points.

More products