Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you do the missing code. If you need more information please go to https://venus.cs.qc.cuny.edu/~mfried/cs313/hw/hw2.html for more info. import java.io.*; import java.util.*; public class HW2

Can you do the missing code. If you need more information please go to https://venus.cs.qc.cuny.edu/~mfried/cs313/hw/hw2.html for more info. import java.io.*; import java.util.*; public class HW2 { // Prints all movies that occur in both lists.  public static void intersection(List list1, 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 year.  // All movies from the same year should be printed on the same line.  // Earlier years should be listed first.  public static void groupByYear(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("1001_movies.txt"); List list2 = getList("rosenbaum.txt"); List list3 = getList("all_lists.txt"); List list4 = getList("sightsound_with_years.txt"); System.out.println("***intersection***"); intersection(list1, list2); System.out.println("***frequent***"); frequent(list3, 3); System.out.println("***groupByYear***"); groupByYear(list4); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

Evaluate the integral. /3 sin e cot e - de sec e /6

Answered: 1 week ago

Question

=+ How well do you think you could do your job?

Answered: 1 week ago