StackOverflow I am a CS student who is having trouble on an assignment who needs someone to assist me with this assignment. The assignment has me take a input file which has data that looks like this:
FirstNameFXO|LastFXO|2510 Main Street|Suite 101D|City100|GA|72249|$280.80
FirstNamePNR|LastPNR|396 Main Street|Suite 100A|City102|GA|24501|$346.01
FirstNameXZU|LastXZU|2585 Main Street|Suite 107C|City101|GA|21285|$859.40
FirstNameHWD|LastHWD|1019 Main Street|Suite 102D|City105|GA|28273|$317.12
FirstNameGHP|LastGHP|2097 Main Street|Suite 109B|City106|GA|72621|$279.28
FirstNameUKM|LastUKM|1087 Main Street|Suite 109C|City106|GA|81463|$711.91
FirstNameKUV|LastKUV|2685 Main Street|Suite 106B|City102|GA|37141|$951.47
FirstNameTBO|LastTBO|1971 Main Street|Suite 103C|City101|GA|63018|$851.35  
There are 1000 lines, I am trying to take this data and create an output file that would be laid out like a letter but the problem I am having is I do not know how to take each individual part of the input so I could have a value that I could use like this:
output.write("Dear" + firstName + lastName, but I do not know how to make them variables. I have created an array that takes each individual line but I am stuck here. Any assistance would be amazing. I am very new to File I/O in general so this is very challenging for me.
import java.io.*;
    import java.util.Scanner;
    public class CollectionLetter {
        public static void main(String[] args) {
            File file = new File("dataCollection.txt");
            String data[] = new String[1000];
            try {
                Scanner s = new Scanner(file);
                while (s.hasNextLine()) {
                    for (int i = 0; i < data.length;i++){
                        data[i] = s.nextLine();
                    }
                    System.out.println(data[1]);
                }s.close();
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
    }
 
    