CSC212 Homework 7 2014

From dftwiki3
Revision as of 09:59, 3 November 2014 by Thiebaut (talk | contribs)
Jump to: navigation, search

--D. Thiebaut (talk) 09:51, 3 November 2014 (EST)



Contents


The program is due on Friday, Nov. 14, at 11:55 p.m.


Problem #1


Look at this javadoc document; it is the javadoc (pdf) of the program you have to implement. It is a heap implemented with an ArrayList of ints.

  • You have to reconstruct it, including all its method, and call the class Heap.java.
  • You will notice that the pop() method returns the top of the heap, but if the heap is empty, it raises an exception of type HeapEmptyException. Its definition is given below. You should create a separate java file for it, and call it HeapEmptyException.java. Your program will automatically find it if you declare it in the same Eclipse package.


public class HeapEmptyException extends Exception{
    //Parameterless Constructor
    public HeapEmptyException() {}

    //Constructor that accepts a message
    public HeapEmptyException(String message){
       super(message);
    }
}