Compare grocery list with leaflet
Hi all!
I used to do some java programing a few years ago. Now I'd like to write a small program that searches for a list of words (my grocery list) in a text file (the supermarket flyer available in text format). I hope someone can help me with the structure/syntax. Here's what I got so far...
import ??
public static etc.
Create a table called "grocery" with a line for every word in the list of goods
for(int i=0; i<n; i++) grocery[i] = ReadLine(); // Where do I specify that the file is grocery.txt?
String flyerLine = Readline(); // Where do I specify that the file is flyer.txt?
String[]flyerWords = flyerLine.split(" "); //split the string into words
for(int i=0; i<n; i++) { //for each word in the grocery table
for(int j=0; i<m; j++) //search every word in the leaflet table
if(grocery[i] == flyerWords[j]) output[k] = flyerWords[j]; k++; //compare & copy to a table
}
output > output.txt
Okay I know this is really basic, but it's been so long since I haven't written a program. Please help me!
Thanks