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 03:10
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately. next, the program determines and prints the prime factorization of the product, listing the factors in increasing order. if a prime number is not a factor of the product, then it must not appear in the factorization. sample runs are given below. note that if the power of a prime is 1, then that 1 must appear in t
Answers: 3
question
Computers and Technology, 22.06.2019 09:40
In the lab, which of the following displayed a list of all installed services and included a description of the service, the current state, and whether the service started automatically or manually? a. the services manager b. the applications summary c. the recommended services d. list the safe services list
Answers: 2
question
Computers and Technology, 23.06.2019 19:00
Choose the correct citation for the case which established the "minimum contacts" test for a court's jurisdiction in a case. select one: a. brown v. board of education of topeka, 347 u.s. 483 (1954). b. international shoe co. v. washington, 326 u.s. 310 (1945) c. haynes v. gore, 531 u.s. 98 (2000). d. international shoe co. v. washington, 14 u.s. code 336.
Answers: 1
question
Computers and Technology, 23.06.2019 21:40
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings. for each match, add one point to user_score. upon a mismatch, end the game. sample output with inputs: 'rrgbryybgy' 'rrgbbrybgy'
Answers: 3
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
Mathematics, 25.02.2020 01:44
Questions on the website: 13722363