Define your own recursive implementation of linklist in a


Programming Project

Write a JAVA program to solve the following problem. Your program should properly compile and run. Your code MUST follow the documentation style used in your textbook. You need to upload into Moodle the following:

• From this point on, each of your projects is expected to be composed of multiple source code files. Thus to organize these files, all of them have to be part of a single package. Your package name MUST match the directory containing your code file. Finally, you need to export your package as a .JAR file then upload this single file into Moodle. If you are not familiar with how to export your code into a .JAR file, please check the following link.

https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftasks-33.htm

Very Important Note: Do NOT upload any other files into Moodle; just ONE file with the extension ".jar" that is it.

Problem Statement:

In this project, you are asked to write a Java application similar to the one you wrote in Project 2 that handles a list of employees employed by a certain company. Your code in project 2 had used the built-in functionalities of the LinkedList class defined in the Java Collection Classes. In this project, you will still use a LinkedList as the main data structure that stores your data but you will provide your own implementation of a class called RecLinkedLink. In doing so, all the required methods to be defined in your RecLinkedList needs to be implemented using recursive algorithms. In other words, method such as size(), replace(), add(), remove, etc. MUST use recursion to achieve it functions. (check chapter 5 for details).

As done before, we will assume that each employee is only represented by her/his first name. The names of all employees in this small company are stored in a given data file called empNames.txt which is posted on Moodle next to this project statement. Your program must do the following task:

1. Define your own recursive implementation of LinkList in a separate file called "RecLinkedList.java".

2. Create an object of RecLinkedList to be used in storing and handling employees' data.

3. Open the given file and read employee data into the RecLinkedList object. In doing so, your code needs to maintain the order of employee data in the input file.

4. Verify the content of the employee data (just read) by displaying them on the monitor using a traditional for loop along with appropriate output messages.

5. Invoke various methods of the RecLinkedList class to retrieve then display the first element and the last element of the list. Display appropriate messages on the monitor.

6. Invoke various methods of the RecLinkedList class to remove the last element then display the size of the list after the removal operation. Display appropriate messages on the monitor.

7. Display the current list contents using the enhanced for loop along with appropriate output messages.

8. Create a ListIterator object, iter, to be used in accessing the RecLinkedList contents.

9. Advance the iterator for five positions then display the current list item (using iterator method and NOT list method).

10. Insert a new employee called "Kelly" at the current iterator position then display the current list contents using the compact form to be used from this point on for any list content display. Hint, use the implicit toString().

11. Execute the iter.previous() method followed by using the iter.set() method to set the current element to Nancy. Then, display the current list contents.

12. Execute the iter.previous() method followed by the remove() method then display the current list contents.

13. In a separate file, create a helper class called HelpLists. This class need to have the code for two methods described below:

a. public void reverse(RecLinkedList strings). This method receives a RecLinkedList object as its parameter then linearly access all the elements in the object while pushing them in a STACK object. You need to use the STACK data structure that you just created to retrieve the data from the stack and display them in reserve order on the monitor.

b. public void FIFO(RecLinkedList strings). This method receives a RecLinkedList object as its parameter then linearly access all the elements in the object while inserting them in a QUEUE object. You need to use the QUEUE data structure that you just created to retrieve the data from the queue and display them in order on the monitor.

14. In your main class, create an object of type HelpLists class then use it in the following.

15. Invoke the reverse method to reverse the order then display the reversed list contents.

16. Invoke the FIFO() method in order to create a queue and use it to ensure that the order of the data in RecLinkedList will be displayed without change.

Text Book: DATA STRUCTURES- Abstraction and Design Using Java by ELLIOT B. KOFFMAN and PAUL A. T. WOLFGANG. THIRD EDITION.

Attachment:- Ziyad_Project.zip

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Define your own recursive implementation of linklist in a
Reference No:- TGS01702117

Now Priced at $70 (50% Discount)

Recommended (95%)

Rated (4.7/5)