Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Question 1 [ 1 0 ] setting up . Code must be in java.Please follow each instruction Study the class definitions below: class Node {

Question 1[10] setting up.Code must be in java.Please follow each instruction
Study the class definitions below:
class Node
{
// attributes
String flight_no; // flight number
Date arrival_time; // time at which flight lands
class PriorityQueue
{
// attributes
int currentSize;
Node root;
FlightNode[] array = new Node [25];
// methods
void clear();
Boolean isEmpty();
Boolean add(Node x);
Node remove();
void percolateDown(int hole);
}
1.1 Create two files Node.java and PriorityQueue.java
1.2 Copy the above definitions into the corresponding files
1.3 Write code for a default and a loaded constructor for Node
1.4 Write code for a default and a loaded constructor for PriorityQueue
1.5 Write accessor and mutator methods for the attributes of Node
1.6 Write accessor and mutator methods for the attributes of PriorityQueue
Question 2[20] adding functionality
Extend the PriorityQueue class:
2.1 Write code for the method void clear() which empties the heap and resets the
size to 0.
2.2 Write code for the method Boolean isEmpty () that checks whether the heap
contains any elements or not.
2.3 Write code for the method Boolean add(Node x) which adds a new node to
the heap
2.4 Write code for the method Node remove()which deletes the root, decreases the
heap size and reorders the remaining heap. It should involve a call to a method
percolateDown(int hole).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

mple 10. Determine d dx S 0 t dt.

Answered: 1 week ago