subject
Computers and Technology, 04.05.2021 18:40 mia3128

(The Queue class) Section 10.6 gives a class for Stack. Design a class named Queue for storing integers. Like a stack, a queue holds elements. In a stack, the elements are retrieved in a last-in
first-out fashion. In a queue, the elements are retrieved in a first-in first-out fashion. The
class contains:
■ An int[] data field named elements that stores the int values in the queue.
■ A data field named size that stores the number of elements in the queue.
■ A constructor that creates a Queue object with default capacity 8.
■ The method enqueue(int v) that adds v into the queue.
■ The method de queue() that removes and returns the element from the queue.
■ The method empty() that returns true if the queue is empty.
■ The method getSize() that returns the size of the queue.
Draw an UML diagram for the class. Implement the class with the initial array size set to 8. The
array size will be doubled once the number of the elements exceeds the size. After an element is
removed from the beginning of the array, you need to shift all elements in the array one position
the left. Write a test program that adds 20 numbers from 1 to 20 into the queue and removes these
numbers and displays them.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
in 2007, floridians died in alcohol-related collisions.a.  501b.  1,051c.  5,015d.  10,839
Answers: 1
question
Computers and Technology, 23.06.2019 15:20
What does a bonus object do? a. subtracts lives b. keeps track of a player's health c. gives a player an advantage d. makes text appear
Answers: 1
question
Computers and Technology, 23.06.2019 21:30
To move a file or folder in microsoft windows, you can click and hold down the left mouse button while moving your mouse pointer to the location you want the file or folder to be, which is also known as.
Answers: 3
question
Computers and Technology, 24.06.2019 12:10
What is it called during the editing process when the processor ensures that a character holding a coffee mug from one angle is holding the same mug in the same way when the shot switches to another camera at another angle? cinematography continuity technology prop use
Answers: 1
You know the right answer?
(The Queue class) Section 10.6 gives a class for Stack. Design a class named Queue for storing int...
Questions
question
History, 15.10.2019 06:10
question
History, 15.10.2019 06:10
question
Mathematics, 15.10.2019 06:10
question
Mathematics, 15.10.2019 06:10
Questions on the website: 13722363