Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone please help writing a proper JAVA program per details below? public class LinkedIntQueue { private Node front, rear; // references for the ends
Can someone please help writing a proper JAVA program per details below?
public class LinkedIntQueue {
private Node front, rear; // references for the ends of the queue private int count; // Node count, number of items in queue
public LinkedIntQueue() {
front = null; rear = null; count = 0;
}
public int deque() {
int rv=0; // return value return rv;
}
public void enque(int d) {
Node newNode = new Node(d); }
public boolean isEmpty() {
return front == null; }
public boolean isFull() {
return false; }
private class Node {
int data; Node next;
public Node(int d) {
data = d; }
}// End class Node
public static void main(String[] args) {
//create a queue
LinkedIntQueue iq = new LinkedIntQueue(); iq.enque(22); iq.enque(1); iq.enque(94);
System.out.println( iq.deque() ); }
}
Queue Implemented with a Linked-List Write a queue class, using a singly linked-list, that allows your queue to store type int. Your class should have the following methods Method Name Return Type Description enque deque isEmpty isFull size none generiC boolean boolean int removes the element at the front of the queue and returns it inserts and element at the rear of the queue returns true if the queue is empty, false otherwise returns true if the queue is full, false otherwise returns the number of elements in a queue In your test class, create a queue and exercise all the methods The following code may be of helpStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started