Starting from:

$30

ASSIGNMENT ONE SOLUTION

For this assignment, you are to implement a basic List of String objects, backed by an array. You should implement the attached interface (StringList) and call your class StringArrayList. I have attached a test file to get you started with JUnit.

Grading:

25 points: your StringArrayList file implements the specified interface and compiles.
6 points (1 point each): your file passes the tests for the add(String), get, size, clear, set, and isEmpty methods.
2 points: your file passes the tests for the contains method.
12 points (3 points each): your file passes the tests for the toArray, add(int, String), indexOf, and remove methods.
5 points: style / implementation / grader's discretion.
Note: the 2 add methods in the interface should return the index where the value was added.
Note: you should *not* be using java.util.ArrayList in your program.

Please submit a file called StringArrayList.java here by September 13 at noon (eastern standard time). You do not need to submit the JUnit test file or the interface.

Remember: to compile your code with JUnit, you need to use a statement like this:

javac -classpath hamcrest-core-1.3.jar:.:junit-4.12.jar StringList.java StringArrayList.java StringArrayListTest.java

and to run your tests, you need to use a statement like this:

java -cp junit-4.12.jar:.:hamcrest-core-1.3.jar org.junit.runner.JUnitCore StringArrayListTest

If you're on Windows instead of a Mac, just replace those colons (:) with semicolons (;) and it should work the same.

We'll talk more about this assignment in class on Wednesday.

More products