I am reading text from one file and appending to another file using parallel string arrays, but I keep getting the error Market.java:84: error: no suitable method found for write(String,String,String,String,String,String,String) and I can't find a way to fix it. My Program:
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
public class Market {
private FileWriter output;
String[] market = new String[100];
String[] name = new String[100];
String[] street = new String[100];
String[] city = new String[100];
String[] state = new String[100];
String[] country = new String[100];
public void openFile() {
try {
output = new FileWriter("report.txt", true);
} catch (SecurityException securityException) {
System.err.println("You do not have write access to this file.");
System.exit(1);
} catch (FileNotFoundException fileNotFoundException) {
System.err.println("Error opening or creating file.");
System.exit(1);
}
}
public void ReadMarket() {
try {
BufferedReader readbuffer = new BufferedReader(new FileReader("markets.txt"));
String strRead;
while ((strRead = readbuffer.readLine()) != null) {
int i = 0;
String splitarray[] = strRead.split("\t");
String firstentry = splitarray[0];
String secondentry = splitarray[1];
String thirdentry = splitarray[2];
String fourthentry = splitarray[3];
String fithentry = splitarray[4];
String sixthentry = splitarray[5];
market[i] = firstentry;
name[i] = secondentry;
street[i] = thirdentry;
city[i] = fourthentry;
state[i] = fithentry;
country[i] = sixthentry;
Writer.write("%-30s%-20s%-30s%-20s%-30s%-20s\n", market[i], name[i], street[i], city[i], state[i], country[i]);
i++;
}
}
catch (IOException e) {
System.out.println("Not Working");
}
}
public void closeFile() {
output.close();
}
}