- Dec 6, 2001
- 2,171
- 1
- 0
I am thourghly confused by this. I am supposed to write a program to read and write off an array. The assignment can be found here if I'm not making much sense: Assignment with a psuedo guide here . Guide. This is what I have so far, I created a token for each but how do I set up this array? We haven't even touched on arrays in class and have to do this so I am COMPLETELY clueless unfortunately.
public class ReadData{
void readData(Inventory[] item)throws IOException{
String line="";
BufferedReader fileInput=new BufferedReader(new FileReader("Sales2.txt"));
//set to receive information by row
for (int row=0;row<5;row++){
line= fileInput.readLine();
StringTokenizer tk = new StringTokenizer(line,",");
String name=tk.nextToken();
String description=tk.nextToken();
String performance=tk.nextToken();
String sales=tk.nextToken();
Am I on the right track or am I completely off? Thanks for the help everyone.
Chris
public class ReadData{
void readData(Inventory[] item)throws IOException{
String line="";
BufferedReader fileInput=new BufferedReader(new FileReader("Sales2.txt"));
//set to receive information by row
for (int row=0;row<5;row++){
line= fileInput.readLine();
StringTokenizer tk = new StringTokenizer(line,",");
String name=tk.nextToken();
String description=tk.nextToken();
String performance=tk.nextToken();
String sales=tk.nextToken();
Am I on the right track or am I completely off? Thanks for the help everyone.
Chris