Bill Manaris : Fall 2005 / CSCI 221 Homework 3

Assigned Date: Monday, Nov. 7, 2005 (sec 2 +1 day)
Due Date: Wednesday, Nov. 16, 2005 (sec 2 +1 day)
Due Time: Noon

Last modified on November 09, 2005, at 02:13 PM (see updates)

Purpose

This assignment focuses on linked structures, and unit testing.

Assignment

Design and implement a CircularQueue ADT using a circular linked implementation (as shown in Figure 5.13 of the textbook). Your ADT should implement QueueInterface.

Interface for a class that implements a queue of Objects.

public interface QueueInterface
{
  public void enqueue(Object item);
  // Effect:         Adds item to the rear of this queue.
  // Precondition:   This queue is not full.
  // Postcondition:  item is at the rear of this queue.

  public Object dequeue();
  // Effect:         Removes front element from this queue and returns it.
  // Precondition:   This queue is not empty.
  // Postconditions: Front element has been removed from this queue.
  //                 Return value = (the removed element)

  public boolean isEmpty();
  // Effect:         Determines whether this queue is empty.
  // Postcondition:  Return value = (this queue is empty)

  public boolean isFull();
  // Effect:         Determines whether this queue is full.
  // Postcondition:  Return value = (queue is full)
}

 

Test Plan

Read the short tutorial Unit testing in BlueJ.

Develop a test plan to test your implementation (see the test plan developed in Chapter 4). Your test plan should include one or more tests for each Queue operation -- tests should be thorough and not redundant.

Details

  1. Use BlueJ to create a test class. (Within BlueJ, you may need to show unit testing tools. Go to Preferences-->Miscallaneous and check Show Unit Testing Tools.)
  2. Right-click on CircularQueue.java. Select Create Test Class. This will generate file CircularQueueTest.java.
  3. Right-click on CircularQueueTest.java. Select Create Test Method. Give it a descriptive name, e.g., TestIsEmpty. This will create the method and start recording your actions... (for the rest, see Unit testing in BlueJ).

Documentation

Your code should be fully documented via javadoc. Your code should throw approppriate runtime exceptions to test preconditions and handle errors.

Include the following in each class:

       Certification of Authenticity:

       I certify that this submission is entirely my own work, 
       as per course collaboration policy.


       Name: ________________________ Date: ___________

Submission

  1. Open your BlueJ project.
  2. Ensure it contains the following: CircularQueue.java, QueueInterface.java, CircularQueueTest.java, and README.TXT.
    1. README.TXT should include (in addition to your name and relevant info), a textual description of your test plan.
    2. CircularQueueTest.java should contian the JUnit implementation of your test plan.
  3. Open (edit) each source file and generate the class interface (javadoc). This can be done within the editor window either by pressing CTRL/J , or selecting the Interface drop-down menu item (on the right). (Note: This is necessary to generate your documentation for grading.)
  4. Under the Project menu, click Create Jar File... . In the dialog box that opens, select Include Source, and press Continue.
  5. Email the generated .jar file to manaris@cs.cofc.edu, by the due date and time.
(Printable View of http://www.cs.cofc.edu/~manaris/?n=Fall2005.CSCI221Homework3)