ICS 111 Homework Assignment H11: Dynamic Array of Strings

Purpose

We are going to continue our problem-solving education by writing an abstract data type, a DynamicArrayOfStrings. This will help us understand Java classes and arrays.

We will also get more practice using Eclipse to make our programming life easier.

Tasks

1. Create a package named edu.ics111.h11 in your project

This is where we will put all our classes for homework 11.

2. Create the class DynamicArrayOfStrings

Create a class named DynamicArrayOfStrings that implements the following two interfaces.

public interface ICS111List {
  int size(); // return the number of strings in the array.
  boolean add(String s); // Adds s to the end of the array. Returns true.
  boolean add(int index, String s); // Inserts s into position index
  String get(int index); // Returns the string at index.
  String set(int index, String s); // Replaces the string at index with s. Returns old value.
  String remove(int index); // Removes the string at index. Returns string.
  boolean remove(String s); // Removes s from the array, returns true if s was in the array.
  int indexOf(String s); // Returns the index of s or -1 if s is not in the array.
  String toString(); // Returns a string represenation of the array.
}

public interface Sortable {
  void sort();  // Sorts the array in increasing order.
}

Your DynamicArrayOfStrings class must use a private String array member variable to hold the Strings. You cannot use an ArrayList to hold the Strings.

You may want to keep track of the number of Strings in your DynamicArrayOfStrings.

I recommend you focus on each method one at a time. Try to figure out how to make the method work. Then go on to the next method.

The sort method can use any sort you want. The text describes two sorts, Insertion Sort and Selection Sort.

3. Make sure you class can pass the tests.

Use the following class to test your implementation TestDynamicArrayOfStrings.java

Grading Rubric

CriterionExcellent (100%)Satisfactory (75%)Borderline (50%)Unsatisfactory (25%)Poor (0)
Adherence to standards - 2 points
Does it conform to standards in every detail?
No errors. Minor details of the assignment are violated, or poor choices are made where the assignment is unclear. Significant details of the assignment or the underlying program intent are violated, but the program still fulfills essential functions. Significant details of the assignment or the underlying program intent are violated, but the program still fulfills some essential functions. Misses the point of the assignment.
Breakdown (modular design) - 2 points
Does it demonstrate good modular design?
No errors. 1-3 minor errors. > 3 minor errors OR 1 major error. 2 major errors > 2 major error.
Correctness of code - 4 points
Does it work? Does it pass JUnit?
Passes all tests. Works for typical input, may fail for minor special cases. Fails for typical input, for a minor reason. Fails for typical input, for a major reason. No.
Documentation, and style - 2 points
Is it clear and maintainable? Does it pass CheckStyle?
No errors. 1-3 minor errors. > 3 minor errors OR 1 major error. 2 major errors > 2 major error.

Turning in the Assignment

The assignment is due on Wednesday, November 26th at 11:55pm. You may turn it in early.