Question
Part 1 : Modify and reuse the code from assignment (class LinkedList.java ) to develop a new class, called Queue.java , to implement queue operations
Part 1 :
Modify and reuse the code from assignment (class LinkedList.java) to develop a new class, called Queue.java, to implement queue operations [enqueue(e), dequeue(), front(), size(), isEmpty()].The implementation of class Queue must use Integer (int) type since we need queue objects in part II below. Also, do not use inheritance; just keep it simple, one stand-alone Queue class that uses linked-list implementation with Integer type.
Next, develop a simple test program, called TestQueue.java, to test all queue operations listed above and included in your own class Queue.java. The test program must test every operation in class Queue with clear outputs, and using meaningful labels and prompts to show the queue content before and after each operation. Make sure you allow the user to enter the queue content (i.e., interactive testing, you may use a menu system in your code). Chapter-23-Part2-Advanced-Radix-Search. Please DO NOT hard-code test data.
Part 2 :
Use class Queue.java you just developed and test in part I above to implement the Radix Sort algorithm using queues. Call the program RadixSort.java. The program prompts the user to enter 6 integer numbers and store them in an array of type integer (call it inputs). The program applies radix sort to the values stored in array inputs and then prints out the content of array before and after being sorted. For example, if the user entered the integer numbers 213, 3465, 7, 29, 541, 45, the program output would be as follows:
----jGRASP exec: java -ea RadixSort
Inputs array before sorting: 213, 3465, 7, 29, 541, 45
Inputs array after sorting: 7, 29, 45, 213, 541, 3465
----jGRASP: operation complete.
Do not treat or manipulate input values as strings at any point for this assignment. They are manipulated as integers throughout the assignment.
Notice that we are using ONLY one array (inputs), and you need 10 queue objects to implement radix sort. See class notes.
Radix sort require digit extraction. To do so, implement a separate method in class RadixSort (call it ExtractDigit()) to do this function. See class notes on how to do digit extraction. You also need a method to do digit count in a number.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started