Question
PLEASE PROVIDE CODE THAT WORKS, EVERYTHING NEEDED TO COMPLETE IS HERE!!!! All the input files needed and the output required is at https://venus.cs.qc.edu/~mfried/cs313/hw/hw2.html, it will
PLEASE PROVIDE CODE THAT WORKS, EVERYTHING NEEDED TO COMPLETE IS HERE!!!!
All the input files needed and the output required is at https://venus.cs.qc.edu/~mfried/cs313/hw/hw2.html, it will say website unprotected just press advanced and proceed to website it is safe. Need this asap!!!!
Three of the methods in HW2.java are incomplete. Write the code so it works correctly. You should submit one file, HW2.java. Do not change the method headers. Each method should print the output to the console. They should not return anything. The purpose of this assignment is to learn how to use the JCF classes (HashSet, HashMap, TreeSet, TreeMap). You do not need to implement these classes. public static List
____________________________________________________________________________________________________________________
//HW2.java import java.io.*; import java.util.*; public class HW2 { // Prints all movies that occur in both lists. public static void intersection(Listlist1, List list2) { // Fill in. } // Prints all movies in the list that occur at least k times // (print the movie followed by the number of occurrences in parentheses). public static void frequent(List list, int k) { // Fill in. } // Prints all movies in the list, grouped by number of characters. // All movies with the same number of characters are printed on the same line. // Movies with fewer characters are listed first. public static void groupByNumChars(List list) { // Fill in. } // Returns a List of all movies in the specified file (assume there is one movie per line). public static List getList(String filename) { List list = new ArrayList<>(); try (Scanner in = new Scanner(new FileReader(filename))) { while (in.hasNextLine()) { String line = in.nextLine(); list.add(line); } } catch (FileNotFoundException e) { e.printStackTrace(); } return list; } public static void main(String[] args) { List list1 = getList("imdb.txt"); List list2 = getList("sight_and_sound.txt"); List list3 = getList("3_lists.txt"); System.out.println("***intersection***"); intersection(list1, list2); System.out.println("***frequent***"); frequent(list3, 3); System.out.println("***groupByNumChars***"); groupByNumChars(list3); } }
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