Add the following methods to the ArrayBoundedQueue class, and create a test driver for each to show that they work correctly. In order to practice your array coding skills, code each of these methods...



Add the following methods to the
ArrayBoundedQueue
class, and create a test driver for each to show that they work correctly. In order to practice your array coding skills, code each of these methods by accessing the internal variables of the
ArrayBoundedQueue
, not by calling the previously defined public methods of the class.






  1. String toString()
    creates and returns a string that correctly represents the current queue. Such a method could prove useful for testing and debugging the class and for testing and debugging applications that use the class. Assume each queued element already provides its own reasonabletoStringmethod.






  2. int space()
    returns an integer indicating how many empty spaces remain in the queue.






  3. void remove(int count)
    removes the frontcountelements from the queue, and throws
    QueueUnderflowException
    if there are less thancountelements in the queue.






  4. boolean swapStart()
    returnsfalseif there are less than two elements in the queue; otherwise it reverses the order of the front two elements in the queue and returnstrue.






  5. boolean swapEnds()
    returnsfalseif there are less than two elements in the queue; otherwise it swaps the first and last elements of the queue and returnstrue.






Notes on doing the assignment:



  1. Must use the folder system provided/used by the textbook to store your assignment files and compiling them, for all your future assignments.

  2. Checkout the files/classes needed to do the modifications asked by the assignment text, from the folders structure of the textbook.

  3. Must keep the file/class names for the files were checked out in step 2 and do not change them.

  4. Keep the package statement (s) in each file and do not change them.

  5. Compile and run the checked-out file(s) in step 2 above, to verify the correctness the given code.

  6. Perform the modifications one at a time, outlined by the assignment text on each file.

  7. Checkback in the files/classes that were checked out in step 2, after making the needed modifications, into the same folders that were checked out from.

  8. Use an independent test class, which must contain a main method to test the modifications asked by the assignment. Check to see, if a test class exists/provided by the textbook. If yes, make modifications to the class/file, to test the modifications were made. If no, must create a new test class, with main method to test the modification were made.


Note:



attach/upload the following files to your assignment:



  1. ArrayBoundedQueue.java

  2. InterfaceArrayBoundedQueue.java

  3. ArrayBoundedQueueDemo.java



Comment throughout code.
Jul 19, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here