Complete the methods in LinkedQueue class. - The enqueue method in this class takes 3 parameters. The dequeue method returns the information stored in a node in the following format: firstName lastName, serviceNumber The peekFront method prints the information stored in the front node in the same format as the dequeue method. The contains method return true if the queue contains any node that has firstName or lastName that is equal to the method parameter. The method also prints the information of every node in the queue that has firstName or lastName that is equal to the method parameter. For example: If the method parameter is "George", the method prints the information of every node that has the name "George" stored in first name OR last name, and at the end the method returns true. The display method prints the information stored in EACH node in the same format as the dequque method.
Complete the methods in LinkedQueue class. - The enqueue method in this class takes 3 parameters. The dequeue method returns the information stored in a node in the following format: firstName lastName, serviceNumber The peekFront method prints the information stored in the front node in the same format as the dequeue method. The contains method return true if the queue contains any node that has firstName or lastName that is equal to the method parameter. The method also prints the information of every node in the queue that has firstName or lastName that is equal to the method parameter. For example: If the method parameter is "George", the method prints the information of every node that has the name "George" stored in first name OR last name, and at the end the method returns true. The display method prints the information stored in EACH node in the same format as the dequque method.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Please complete the code and make sure it runs
package chapter04.queues;
public class LinkedQueue
{
protected PersonNode front;
protected PersonNode rear;
protected int numElements;
public LinkedQueue()
{
front = null;
rear = null;
numElements = 0;
}
public void enqueue(T fName, T lName, T sNum)
{
//Complete this method as required in the homework instructions.
}
public T dequeue()
{
//Complete this method as required in the homework instructions.
}
public void peekFront()
{
//Complete this method as required in the homework instructions.
}
public boolean contains(T lookFor)
{
//Complete this method as required in the homework instructions.
}
public void display()
{
//Complete this method as required in the homework instructions.
}
public int size()
{
return numElements;
}
public boolean isFull()
{
return false;
}
public boolean isEmpty()
{
return numElements == 0;
}
}
package chapter04.queues;
public class TestLinkedQueue
{
public static void main(String[] args)
{
LinkedQueue queue = new LinkedQueue();
System.out.println(queue.isEmpty());
/*
queue.enqueue("George", "Smith", "1901");
queue.enqueue("Eve", "Connor", "1783");
queue.enqueue("Else", "George", "1932");
queue.enqueue("Lina", "Wanner", "1245");
System.out.println();
queue.display();
System.out.println();
System.out.println("Empty? " + queue.isEmpty());
System.out.println();
System.out.println("Size: " + queue.size());
System.out.println();
String r = queue.dequeue();
System.out.println(r + " removed");
System.out.println();
queue.display();
*/
}
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education