Our first abstract data structure is the List. For this homework assignment we are going to implement a sortable list using an array to store the items in the list. This assignment should give you more practice with problem solving, using Eclipse and implementing an interface. We will also use our implementation of the list as a member variable and learn about delegation.
This is where we will put all our classes for homework 04.
Create the two interface java files and paste the contents into them.
The SortableList must use an array to store the items in the list.
I recommend you focus on each method one at a time. Each method is it’s own problem that you need to solve. Think about the steps you need to take to solve them. For example, what are the steps needed to implement the E get(int index) method?
Once you are done with a method move on to the next method. For the sorting methods use the Comparator to compare the items in the list. The sort methods should sort the list in ascending order, smallest at the beginning, largest at the end. This is very similar to homework 03 where we sorted an array of E’s. Do you want to sort the whole array or just the part that holds the items?
Create the JUnit test class SortableListTest.
Please thoroughly test your code and briefly discuss your testing strategy. You can put your discussion in a comment in the SortableListTest class. Make sure that you test the different sorting algorithms. Turn in all your test code.
The class SortableBeerList implements IList211<Beer> and has:
Every time a beer is added to the SortableBeerList the list will sort the beers. Do we need to sort the beers when we remove a beer or get a beer? How about when someone uses the set method?
We are going to use the SortableBeerListTest.java JUnit tests to evaluate your SortableBeerList class for correctness.
Criterion | Excellent (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) - 1 point 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. |
Efficiency of code - 1 point Does it use the Java features well? |
No errors. | 1-3 minor errors. | > 3 minor errors OR 1 major error. | 2 major errors | > 2 major error. |
The assignment is due on Friday at 11:55pm. You may turn it in early.