title: Adding to an object array list using a file reader
body: <p>Basically I have to classes interacting with one another in this situation one company and one the driver, this code is written in the driver. So I am using a file reader to scan a text file that looks like this with a space between each line.</p>
  <blockquote>
  <p>John:Smith:Manufacturing:6.75:120:444</p>
  <p>Betty:White:Manager:1200.00:111</p>
  <p>Stan:Slimy:Sales:10000.00:332</p>
  <p>Betty:Boop:Design:12.50:50:244</p>
  </blockquote>
  <p>And the code is as follows. The addEmployee method of the company class has a (string, string, string, double, int, int) parameter. The text file it reads in has a colons inbetween each part, so howe can I add it to the arraylist of objects. And keep going until all of them are read. Sorry if my questions difficult to understand, if you want me to elaborate let me know in the comments. I just didn't want to make the question too long.</p>
  <pre><code>else if (e.getSource()==readButton){
              JFileChooser fileChooser = new JFileChooser(&quot;src&quot;);
          if  (fileChooser.showOpenDialog(null)==JFileChooser.APPROVE_OPTION)
          {
              empFile=fileChooser.getSelectedFile();
          }
              Scanner scan = new Scanner(&quot;empFile&quot;);
              while(scan.hasNext()){
                  scan.next().split(&quot;:&quot;);
                  if (position.equals(&quot;Manager&quot;)){
                      c.addEmployee(fName, lName, position2, Double.parseDouble(firstParam2), 0, Integer.parseInt(empNum2));
                  }
                  else if(position.equals(&quot;Sales&quot;)){
                      c.addEmployee(fName, lName, position2, Double.parseDouble(firstParam2), 0, Integer.parseInt(empNum2));
                  }
                  else{
                      c.addEmployee(fName, lName, position2, Double.parseDouble(firstParam2), Integer.parseInt(secondParam2), Integer.parseInt(empNum2));
                  }
              }
  </code></pre>