CSE 461 Homework 1

Due Friday January 16

Implement a priority queue in Java. The goal of this assignment is to get everyone up to speed on writing, compiling and testing Java programs, so there is some flexibility. What you need to do is:

Compiling and running in Visual J++

To compile and test your priority queue in Visual J++, you should be able to do the following:
  1. Create a workspace
  2. Save the test file above as PQTester.java
  3. Save the file below as PriorityQueue.java
    // File: PriorityQueue.java
    class PriorityQueue
       public PriorityQueue ()
          // constructor: initialize any private data here.
       public void Insert (Object data, double priority)
       public Object Remove ()
          return null;
  4. Insert both files into teh worksapce
  5. Under Project/Settings/Debug (i.e. the Debug pane of the Project/Settings dialog), in the "General" category, change the radio button to the choice for standalone application, and enter PQTester as the class to run.
  6. Build the project
  7. Run the project


    To turn in this assignment, please print out and hand in the following (enscripted 2-up printouts are fine, text files are fine, TeX'd documents with lots of cute graphics are fine, but serious overkill). This isn't a terribly big assignment, so I'm not expecting a whole lot
    1. Your name (you'd be suprised)

    2. A brief description of how you solved the problem and what you think is interesting about your solution. A couple of sentences is probably appropriate here, more than a couple of paragraphs is not. What I'd like is enough of a roadmap so I'll know what to look for in your code. Things worth mentioning might include what kind of a data structure you used and whether your class holds generic Objects or ints or something more interesting. If you added something cool you might say something here.

    3. The Java source code for your priority queue class
    4. The Java source code for your test routine (doesn't need to be fancy, the example above is fine if it works, I just want to see something that calls your code).
    5. A transcript of the output you get from running your program
    Turning in on paper with your own tester should eliminate most if not all problems of file, class and function naming, and should allow you to show off any neat things that you did. The sum of your textual description and the comments in your code should be sufficient for someone to fairly easily figure out how it works.

    Please bring the paper copy to class on friday. If you need to make special arrangements (either for turnin or extensions) please send Andy (acollins@cs.washington.edu) email.


    The point of this assignment is to get you programming in Java. If you have extra time and want to do more, or if you are having trouble with some of the things above, here are some ideas, all of which are acceptable.