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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 14:40, coryowens44
For this assignment you have to write a c program that will take an infix expression as input and display the postfix expression of the input. after converting to the postfix expression, the program should evaluate the expression from the postfix and display the result. what should you submit? write all the code in a single file and upload the .c file. compliance with rules: ucf golden rules apply towards this assignment and submission. assignment rules mentioned in syllabus, are also applied in this submission. the ta and instructor can call any students for explaining any part of the code in order to better assess your authorship and for further clarification if needed. problem: we as humans write math expression in infix notation, e. g. 5 + 2 (the operators are written in-between the operands). in computer's language, however, it is preferred to have the operators on the right side of the operands, ie. 5 2 +. for more complex expressions that include parenthesis and multiple operators, a compiler has to convert the expression into postfix first and then evaluate the resulting postfix write a program that takes an "infix" expression as input, uses stacks to convert it into postfix expression, and finally evaluates it. it must support the following operations: + - / * ^ % ( example infix expression: (7-3)/(2+2) postfix expression: 7 3 2 2 result: rubric: 1) if code does not compile in eustis server: 0. 2) checking the balance of the parenthesis: 2 points 3) incorrect postfix expression per test case: -2 points 4) correct postfix but incorrect evaluation per test case: -i points 5) handling single digit inputs: maximum 11 points 6) handling two-digit inputs: 100 percent (if pass all test cases)
Answers: 3
image
Computers and Technology, 22.06.2019 19:00, sere50
Stacy works as blank. the most important soft skill she needs for this role is blank.
Answers: 3
image
Computers and Technology, 24.06.2019 19:20, maehardy4134
Kiesha has a worksheet with a range of cells using the following columns: name, score, group, study group, and date. kiesha needs to sort the worksheet on the date field. which option she use to most efficiently complete this task ? a use the cut and paste option to reorganize the data to fit that order b use the filter function to organize the data based on the date c use the order function to organize the data based on the date d use the sort function to organize the data based on date order
Answers: 3
image
Computers and Technology, 24.06.2019 19:50, joThompson
Which is a characteristic of free and open-source software licenses? a. the source code is unavailable to everyone b. the source code is available only to the government c. the source code is available to all users d. the source code is constantly modified
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 in other subjects:

Konu
Mathematics, 24.12.2021 02:40
Konu
Biology, 24.12.2021 02:50