title: Add up Figures in Different Files for same Customer Named
body: <p>I have a requirement where I have Multiple Customer Invoices as different files. I am able to read the Customer Name and the Invoice Amount from each Invoice. The requirement is that for one customer, I should add up all the invoice amounts.</p>
  
  <p>Here Is My Code:</p>
  
  <pre><code>String[] filenames1 = laf.splitFileNames();
  FileInputStream fs;
  BufferedReader br;
  String line;
  for (String filename1 : filenames1) {
      fs = new FileInputStream(outFolder + filename1);
      br = new BufferedReader(new InputStreamReader(fs));
      for (int m = 0; m &lt; 1; m++) {
          br.readLine();
      }
      line = br.readLine().trim();
      String cust_name = line.substring(12);//Returns the Customer Name
      String amount = rll.lastNonBlankLine(new File(outFolder + filename1));//Returns Invoice Amount in String format
      System.out.println(cust_name + "-" + rll.lastNonBlankLine(new File(outFolder + filename1)));
  }
  </code></pre>
  
  <p>My Out put:</p>
  
  <pre><code>TAITA TAVETA TEACHERS SACCO-25,101.53
  TAITA TAVETA TEACHERS SACCO-12,927.62
  TAITA TAVETA TEACHERS SACCO-12,927.62
  NOT FOR CUSTOMER-12,927.62
  </code></pre>
  
  <p>Ideally I should be able to get:</p>
  
  <pre><code>TAITA TAVETA TEACHERS SACCO-50,956.77
  NOT FOR CUSTOMER-12,927.62
  </code></pre>
  
  <p>Please assists at this point where I am stuck.</p>