Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Build and use your own minimal queue class using an array of type String of fixed size. to hold the queue. a) Create a NetBeans

Build and use your own minimal queue class using an array of type String of fixed size. to hold the queue.

a) Create a NetBeans project and name it p5_4_your-id.

i. The array should have the default size of 5.

ii. The array size should be setable via a constructor.

iii. The following methods must be implemented:

a) enqueue inserts a value at the rear of the queue

b) dequeue returns the value at the front of the queue, removing the value from the queue

c) isEmpty returns true if the queue is empty, false otherwise

d) isFull - returns true if the queue is full, false otherwise

Tip: In a queue of 2 or more elements, the index of the rear is larger than the index of the front EXCEPT, the queue will need to wrap around the array. For example: If the array is 20 elements. the queue front is at index 15 and the queue rear is at index 19, the next enqueue will be at index 20, which doesn't exist. The index must wrap around the array, i. e. the next enqueue will be at index 0. The solution is to modulus by the array size whenever increasing an index, either rear of front. For example, to change the index of the rear to the next index,use the formula

rear = (rear + 1) % arraySize;

b) Add code to your project demonstrating the queue and all methods and constructors in the class work correctly.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

7. General Mills

Answered: 1 week ago

Question

3. Describe the strategic training and development process.

Answered: 1 week ago