Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You and your partner are going to fill in these methods working with Lists - the main method has already been completed for you. The
You and your partner are going to fill in these methods working with Lists - the main method has already been completed for you. The getList method is very similar to the exercise we did in a previous week's lab, so feel free to look at what you did for that lab (or go back to the course notes for sample code). All three methods make use of the List methods discussed in class, so you will also want to refer to the course slides on List and ArrayList for more sample code. The files named test.txt and test2.txt are available to download if you are working on this in Eclipse instead of in the browser (note that you will need to save these text files in the project folder you create for this lab and not the src folder of the project folder if you choose to do it that way). Your final lab should produce output like the following:
Enter a filename: test1.txt Enter another: test2.txt Wordlist 1 ---------- 0: the 1: quick 2: brown 3: fox 4: jumps Wordlist 2 ---------- 0: over 1: the 2: lazy 3: dog List 1 merged with List 2 ------------------------------------ 0: the 1: over 2: quick 3: the 4: brown 5: lazy 6: fox 7: dog 8: jumps List 2 merged with List 1 ------------------------------------ 0: over 1: the 2: the 3: quick 4: lazy 5: brown 6: dog 7: fox 8: jumps
Note that the mergeLists method is a bit tricky and involves more than one loop. Before you begin coding, think about the algorithm for building the new list. Write it up in the comments of your method and then fill in the code around your algorithm (as demonstrated in class).
Step by Step Solution
★★★★★
3.45 Rating (168 Votes )
There are 3 Steps involved in it
Step: 1
Heres a template for the methods getList mergeLists and the main method import javaioFile import jav...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