Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java Description Food poisoning is a fairly common and entirely unplcasant occurrence. When there is an outbreak of food poisoning, the State Health Department has
Java
Description Food poisoning is a fairly common and entirely unplcasant occurrence. When there is an outbreak of food poisoning, the State Health Department has to try to identify the food that is the likely source. They do this by looking for similarities between the list of foods that were eaten by people who have been medically diagnosed as having food poisoning. Suppose that people who have had food foods poisoning had recently eaten the following Food count max alfalfa sprouts bean sprouts Bean Sprouts Lettuce CBgS Ground Beef bean sprouts bean sprouts cabbage Eggs spinach tomatoes Bean sprouts Alfalfa Sprouts Bean Sprouts CBgS bean sprouts2 bean sprouts 3 bean sprouts4 bean sprouts 5 cabbage ground beef 1 lettuce spinach tomatocs Read File The method that performs this task is: public static Stringl] cntcrData(String filename) Change all Words to Lower Case Find the Most Common Lines Finding the most common lines in the file is more challenging. The best strategy is to put the lines in sorted order first, and then count ones that are similar (that will be right next to each other). If we do this with the original data, we will have the left column of the table below To find the most common line in file, you need to count the elements that are identical. The Count variable shows how this would look for this data. We also need to keep track of the biggest count to this point. The max column shows how this could be done. The method signature is: public static String Strinsl] data)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