Question: In this project, you will be designing and implementing a Java program that uses the Queue data structure. Your program should be able to demonstrate
In this project, you will be designing and implementing a Java program that uses the Queue
data structure. Your program should be able to demonstrate the functionality of the queue
structure and show how it can be used in realworld scenarios.
Instructions:
Design a Java program that uses the Queue data structure. Your program should include
the Queue code which is included with my notes and we discussed in class.
Your program should include at least three different operations for the Queue data
structure.
Your program should also include error handling for unexpected scenarios.
You can choose any realworld scenario to demonstrate the use of this data structure.
Some examples could be a restaurant order system, a shopping cart, or a playlist
manager.
Write documentation that explains the purpose of your program and how it works.
Requirements:
Your program should be wellstructured and easy to read.
Your code should be properly commented to explain the functionality of each method.
Your documentation should include the purpose of your program, how it works, and
how to run it The documentation should also describe the use of any tools that helped
you with the design, including AI tools.
Your program should be free of errors and able to handle all possible scenarios.
You should be able to answer any question regarding your project and your code.
Grading: Your project will be graded based on the following criteria:
Proper application of the Queue data structure
Functionality of the program
Error handling
Code readability and commenting
Documentation
Your program should include
the Queue code which is included with this code below
class QueueApp
public static void mainString args
Queue theQueue new Queue; queue holds items
theQueue.insert; insert items
theQueue.insert;
theQueue.insert;
theQueue.insert;
theQueue.remove; remove items
theQueue.remove;
theQueue.remove;
theQueue.insert; insert more items
theQueue.insert; wraps around
theQueue.insert;
theQueue.insert;
whiletheQueue.isEmpty remove and display
all items
long n theQueue.remove;
System.out.printn;
System.out.print;
System.out.println;
end main
end class QueueApp
class Queue
private int maxSize;
private long queArray;
private int front;
private int rear;
private int nItems;
public Queueint s constructor
maxSize s;
queArray new longmaxSize;
front ;
rear ;
nItems ;
public void insertlong j put item at rear of queue
ifrear maxSize deal with wraparound
rear ;
queArrayrear j; increment rear and insert
nItems; one more item
public long remove take item from front of queue
long temp queArrayfront; get value and incr front
iffront maxSize deal with wraparound
front ;
nItems; one less item
return temp;
public long peekFront peek at front of queue
return queArrayfront;
public boolean isEmpty true if queue is empty
return nItems;
public boolean isFull true if queue is full
return nItemsmaxSize;
public int size number of items in queue
return nItems;
end class Queue
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
