Lab 8
Priority Queue
Objective

Use a heap to build a data structure known as a 'Priority Queue'.

Description

First, download the driver. Remember, do NOT modify the driver class.

Create a class called Process with the following:

Create another class called ProcessHeap with the following:

Example Dialog

        The current heap is:
        e p: 33 t: 23.00
        c p: 20 t: 18.00
        g p: 16 t: 5.00
        b p: 5 t: 20.00
        d p: 18 t: 29.00
        f p: 1 t: 15.00
        a p: 10 t: 50.00
        Current heap in sorted order:
        e p: 33 t: 23.00
        c p: 20 t: 18.00
        d p: 18 t: 29.00
        g p: 16 t: 5.00
        a p: 10 t: 50.00
        b p: 5 t: 20.00
        f p: 1 t: 15.00
        Starting simulation
        Process: e p: 33 t: 23.00 is starting
        Process: e p: 33 t: 23.00 has ended
        Process: c p: 20 t: 18.00 is starting
        Process: c p: 20 t: 18.00 has ended
        Process: d p: 18 t: 29.00 is starting
        Random process added! Random Process p50 p: 10 t: 10.00
        Process: d p: 18 t: 29.00 has ended
        Process: g p: 16 t: 5.00 is starting
        Process: g p: 16 t: 5.00 has ended
        Process: Random Process p50 p: 10 t: 10.00 is starting
        Process: Random Process p50 p: 10 t: 10.00 has ended
        Process: a p: 10 t: 50.00 is starting
        Random process added! Random Process p100 p: 20 t: 20.00
        Process: a p: 10 t: 50.00 has ended
        Process: Random Process p100 p: 20 t: 20.00 is starting
        Random process added! Random Process p150 p: 30 t: 30.00
        Process: Random Process p100 p: 20 t: 20.00 has ended
        Process: Random Process p150 p: 30 t: 30.00 is starting
        Process: Random Process p150 p: 30 t: 30.00 has ended
        Random process added! Random Process p200 p: 40 t: 40.00
        Process: Random Process p200 p: 40 t: 40.00 is starting
        Process: Random Process p200 p: 40 t: 40.00 has ended
        Process: b p: 5 t: 20.00 is starting
        Simulation time has expired
    
Finally:

Upload the .java file to the dropbox