CSCI605 Week 7 Assignment 1 solution

$25.00

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (8 votes)

Your assignment is to modify the assignments from the last few weeks to include exceptions.

I expect to see an IndexOutOfBoundsException, wherever an index into your storage is being used. I also want our storage to only allow for even elements for strings and integers.

If someone tries to add a non-even integer value when Integer is the type parameter, throw a NonEvenException. If someone tries to add a non-even length string when String is the type parameter, throw a NonEvenException. A NonEvenException should be enforced by the compiler (checked exception).

 

Your addAll method should be atomic, that is to say that either you add all elements from the array or you add none. An error being thrown while adding all would be grounds to enforce the atomicity of the method and revert the state of the storage to what it was prior to the operation and then return a false to the calling method.

 

You should modify your test program to prove your exceptions work as expected.

 

You should include your thoughts on how exceptions improved your solution over the previous weeks as a part of your assignment 3. You should also note the differences in your implementation for a checked exception versus an unchecked exception.

 

Your abstract class should be called StorageAbstract.java.

 

Your concrete implementations should be called ArrayList.java and LinkedList.java. You may need to modify your interface.

 

Grading:
Correctness: You can lose up to 20% if your solution is not correct
Quality: You can lose up to 20% if your solution is poorly designed
Testing: You can lose up to 20% if your solution is not well tested
Explanation: You can lose up to 40% if you cannot explain your solution during the grading session