ArrayPriorityList



Project: LinkedPriorityList implements PriorityList

Collaboration: Complete this project only with help from UofA Section Leaders and the course materials (books, presentations, code demos). Do not give your code to anyone or copy any code. Do not even look at another's screen with code from this project by another student.

Preview: This project asks you to develop class LinkedPriorityList that implements the same PriorityList ADT specified as a Java interface. This project has the following goals:

• Implement a familiar ADT using a different data structure: singly-linked data structure

• Revisit how generic classes safely store collections of the same type

• Use exceptions to handle out of range indexes and test methods to ensure they do indeed throw exceptions

Use a Singly Linked Structure with your existing test cases

LinkedPriorityList implements PriorityList includes class Node to ensure you will use instances of this private inner class to store a reference to the data and also to the next element (or null in the last node). This collection class has all methods implemented as stubs so tests can compile immediately (or after a few small changes to your unit test).

You will need a unit test for this. Because ArrayPriorityList and LinkedPriorityList have the same methods as each other (specified by interface PriorityList), you could use a copy of your existing ArrayPriorityListTest.java to test all code. Then change all occurrences of ArrayPriorityList to LinkedPriorityList.

You can also get the with comments and compiling method stubs that begins like this (add your name and description as comments):

public class LinkedPriorityList implements PriorityList {

// This private inner class saves lots of typing and is hidden from outsiders

private class Node {

// These instance variables can be accessed from the enclosing class

private E data;

private Node next;

public Node(E element) {

data = element;

next = null;

}

public Node(E element, Node link) {

data = element;

next = link;

}

}

// These instance variables belong to the enclosing class LinkePriorityList

private Node first;

private int size;

// Create an empty list with zero elements

public LinkedPriorityList() {

first = null;

size = 0;

}

// . . . Methods implemented as stubs in the zip file

}

Grading Criteria (100 points, subject to change)

Style/Readability 10pts

+2 You included your name as a comment in all files

+2 You have a 1 or 2 sentence description of the purpose of each class

+2 The source code is formatted nicely (in Eclipse use Source > Format)

+2 Used meaningful identifiers

+2 All methods are commented with an accurate description in LinkedPriorityList

Problem and Code Coverage 90pts

+90 Web-Cat correctness and code coverage: To get 100% for these 90 points, you will need 100% problem coverage only, which means Rick's tests pass and you exercised all methods. You can get a score of 0 even though all of your tests passed in your workspace because

• WebCat reports a compile time error (look for Unknown symbol).

• One of Rick's test cases placed your loop into an infinite loop (Timeout error)

• One of your assertions failed on WebCat (even though it passed for you locally)

• Please note other ways to lose points when graded by your TA:

Up to -100 pts, a zero (0), will be given if you didn’t use the singly-linked structure of Node objects (you may not use the same code as the previous assignment with Object[] or a Java collection class

-20 The initial capacity of data was changed from 20 (leave it as 20)

-1 pt for every WebCat submission more than 10, up to -30 points: Example: 3 days late with 40

submissions would be a maximum of 40/100 even with 100% code and problem coverage

You can also get a score of 0 even though all of your tests passed in your workspace because

• WebCat reports a compile time error (look for Unknown symbol)

• One of Rick's test cases placed one of your loops into an infinite loop for a Timeout Error

• One of your own assertions fails on WebCat

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download