Question: can i have the code in java Introduction: A Queue (or line) helps people to be served in the order they request a service; For

can i have the code in java Introduction: A Queue (or line) helps people to be served in the order they request a service; For example, people form a Queue (line) as they enter the post office. When a person arrives, he or she goes to the End of the Queue (line) and the person at the Front of the Queue (line) is the person who is served next. Question: The Queue.java class simulates a queue of integer numbers. A new integer is added to the end of the queue using the addToEndOfQueue(int val) method. The getNext() method returns the next integer in front of the queue. The size() method returns the number of integers currently in the queue. 1- Complete the following methods in Queue.java: a) public Queue() creates a queue (The constructor method). b) public void addToEndOfQueue(int val) adds the integer val to the end of the queue. c) public int getNext() removes the next integer from the front of the queue and returns it. d) public int size() returns the number of elements (integer numbers) that are currently in the queue. 2- Run QueueDemo.java and verify that the following output is generated: Current Queue size: 3 Next number in the queue: 10 Current Queue size: 2 Next number in the queue: 5 Next number in the queue: 18 Current Queue size: 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!