CSCI 1302 Homework #5 Due 11:30pm, April 11, Saturday, 2020 (100pts) Practice GenericStack.java and TestGenericStack.java in Folio. Adapt the GenericStack class to implement a class named GenericQueue...

can you do this in 1 hour and 30 minutes?


CSCI 1302 Homework #5 Due 11:30pm, April 11, Saturday, 2020 (100pts) Practice GenericStack.java and TestGenericStack.java in Folio. Adapt the GenericStack class to implement a class named GenericQueue for the queue data structure. Recall that a stack stores a dynamic collection of objects in a last-in-first-out manner, while a queue stores a dynamic collection of objects in a first-in-first-out manner. Your class should satisfy the following: (1) It uses an ArrayList to store the collection of objects internally; (2) It should replace the push method of the GenericStack class with an add method to add an object to the tail of the queue; (3) It should replace the pop method the GenericStack class with a remove method to remove an object from the head of the queue. Adapt the TestGenericStack class to a class with name TestGenericQueue to test your GenericQueue class. For simplicity, your main method can create four Integer objects of random values between 0 and 99 to be added into a queue and then remove two of these four objects from it. After that, print the remaining Integer objects in the queue. Sample run of the program can look like the following: C:\> java TestGenericQueue adding 48 to the queue. adding 83 to the queue. adding 99 to the queue. adding 59 to the queue. removing the head of the queue: 48 removing the head of the queue: 83 Now the queue contains: queue: [99, 59] Program Implementation Requirements: · You can decide whether you want to put your classes in the same file or in separate files. Submit your program (the .java source file(s)) to the dropbox a5 folder by deadline. Do not send any screen shot. Do not send any .pdf file, or MS Word file, or any similar Word-Processing file, or .class file.
Mar 31, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here