It is important operations that are usually defined for the proper management of a well-defined queue (and by extension a well-defined priority queue). Throughout the course we have emphasized some features of the Java programming language that allow flexible and effective development of software. One such feature is the ability to write a formal Java interface type. You may recall that a Java interface can be used to specify a minimum set of operations that any programmers implementation of that type must provide. While a Java interface rigorously specifies what operations are to be provided, it allows any programmer that develops an implementation some autonomy about exactly how those operations will be carried out. For this assignment you will be given a Java interface for a well-defined priority queue. The priority queue stores only integer data: the larger the integer value of a data item the higher its priority. You also have access to the executable (bytecode only) version of one implementation of that priority queue. You do not have access to the .java file for this priority queue. Your task will be to design and specify a test-plan for a well-defined priority queue. You must then write one or more test-programs, based on your test plan, to determine whether the priority-queue implementation you have been given functions properly as a well-behaved priority queue. The key difference between a regular queue and a priority queue is the ordering of the elements. New elements that are added to the queue (using enQueue) should not necessarily be added directly to the end of the queue, but in a position dependant on their priority so higher priority elements should be closer to the head of the queue than lower priority elements. For simplicity, elements in this work are simply Integer values the bigger the value the higher the priority

this includes a link to a zip file called This zip-file contains a Netbeans project called priorityqueue and you should download and unzip your own copy of this Netbeans project. You will see that the priorityqueue project contains a number of Java classes:

  • PriorityQueueInterface a Java interface type that defines the set of public operations that must be supported by any priority queue implementation.
  • QueueBoundaryException a Java class that can help any test-program(s) you write to deal with boundary conditions gracefully.
  • QueueProgram a Java class containing a main method and a method for running tests. The main method sets up an ArrayProrityQueue for you to test. It is upt o you how big the queue you test should be.
  • ArrayProrityQueue an array-based implementation of a priority queue. You only have an executable bytecode-version of this class (no source-code is supplied). To aid you in your testing, this class also includes a method called displayQueue. This method is not listed in the interface, as it would not usually be considered one of the proper operations of a priority queue. This class is not found in the usual class folder, but instead in a folder called arrayqueue. If you have any problems with obtaining your own copy of the priorityqueue project you should seek help straight away from your lecturers, demonstrators or teaching assistants etc.

Part 1 Testing a Priority Queue (30%) For Part 1 of this assignment you are required to design a test-plan for a priority queue.

Part 1 does not require you to actually carry out the tests (that is what is done in Part 2 of the assignment!)

Your test-plan should be in tabular form. It should clearly identify data values and particular sequences of operations that will determine whether the supplied ArrayPriorityQueue bytecode is a valid implementation of the PriorityQueueInterface type.

Your tabulated test-plan should have one row for each test you decide to carry out and each row should contain the following clearly headed columns:

1. Test number.

2. Test description. You need to identify as many problematic priority queue states, conditions and sequences of operations as possible; a minimal set of tests can be gleaned from the pre- and post-conditions listed with each method in the PriorityQueueInterface.

3. Predicted outcome. For all of the conditions you test it is important that your test-plan documents the predicted outcome of each test if the implementation is to be considered a valid priority queue.

4. Actual outcome. All of the cells in this column should be left blank/empty for now. (These cells will record the actual results of the tests, once you have carried them out in Part 2 of the assignment.)

It will be perfectly OK to augment your test-plan as new ideas for tests occur to you during Part 2 of the assignment. But it is good practice to devise as much of your testplan as possible, in advance of starting Part 2. (Note Parts 1 and 2 have the same hand-in deadline)

Part 2 Testing an array-based Priority Queue (70%) For this part of the assignment you should verify that the ArrayPriorityQueue implementation you have been given properly implements the operations of the PriorityQueueInterface.

You should establish this by writing one or more test-program(s) that will carry out all of the tests you have devised for your test-plan from Part 1 of the assignment.

It is recommend that tests are written in the runtests method of the QueueProgram class, though you are welcome to create new classes or methods if you wish to. All classes should be created within the priorityqueue Netbeans project.

Test-program(s) written to attract a good mark, must adhere to the general principle that the main method of the program should coordinate the operations you want the program to carry out leaving the detailed coding for each of those operations to ancillary helper methods. Test-program(s) written to attract an excellent mark, must use the Java try and catch language features to gracefully deal with any exceptional situations that may arise during your suite of tests thereby avoiding runtime program crashes.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.