Question: Step 1: Write a program that reads a list of names from a file and constructs an ordered list. For example, if the input text

Step 1: Write a program that reads a list of names from a file and constructs an ordered list. For example, if the input text file is: Shai Tom Jim Aaron Barbara Beth Fred Jack Jarred Jill Amar Ralph Jill Hillary it should create the following ordered list. Print the contents of the list: [Aaron, Amar, Barbara, Beth, Fred, Hillary, Jack, Jarred, Jill, Jim, Ralph, Shai, Tom] Note: Although Jill is repeated in the input list, the ordered list does not have repeated items.

Step 2: Modify the above program so that it reads two text files each containing a list of names and constructs two ordered lists.

Step 3: Add a method to the above program that takes as input two ordered lists and returns a third list that is a merger of the two ordered lists. Use the two-finger walking algorithm discussed in class. For example, if list1 is: Amar Boris Charlie Dan Fujian Inder Travis and list2 is: Alex Ben Betty Charlie Dan Pei Travis Zola Zulu the method should create the following new ordered list and return it: Alex Amar Ben Betty Boris Charlie Dan Fujian Inder Pei Travis Zola Zulu Note: The header of the method should be written as follows: public static > OrderedList merge (OrderedList list1, OrderedList list2) { //your code here } Your final code should be one java class file that reads two files containing random names, creates two ordered lists from these names, merges them and displays the three lists

Java

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!