title: What can be the possible test cases?
body: <p>I was given the following question in a programming test but i cannot seem to understand why it could't clear all the test cases. What possible test cases am I missing?</p>
  
  <p>A credit card company charges the customer on each transaction as per the following rules:</p>
  
  <ol>
  <li>If transaction amount is less than 5000.00,charge is 2.0% of amount.</li>
  <li>If transaction amount is greater than equal to 5000.00,charge is 1.5% of amount.</li>
  <li>If transaction amount is greater than 10000.00,charge is 1.0% of amount.</li>
  <li>If previous transactions for a customer in that month are greater than 50000.00 charge is 0.5% of amount.</li>
  <li>The first two transactions for any month with amount less than equal to 5000.00 are free.</li>
  <li>All charges are rounded off to the next greater whole amount. eg. 9.23 to 10.00.</li>
  </ol>
  
  <p>WAP to calculate the charge.</p>
  
  <p>Input is given as follows: First line contain the number of transactions say N. The next N lines contain the transaction details in order :  Transaction date,Customer Name,Amount.</p>
  
  <p>Output: Print charges for transactions in the order of given transactions(one per line).</p>
  
  <p>Eg. Sample input</p>
  
  <pre><code>10
  
  2014-06-13,ABC RETAIL,10000.00
  
  2014-06-14,ABC RETAIL,40000.00
  
  2014-06-20,ABC RETAIL,1000.50
  
  2014-06-23,XYZ RETAIL,9000.00
  
  2014-06-23,ABC RETAIL,5000.00
  
  2014-06-24,ABC RETAIL,100.00
  
  2014-07-12,XYZ RETAIL,900.00
  
  2014-07-13,XYZ RETAIL,55000.00
  
  2014-07-13,XYZ RETAIL,550.00
  
  2014-07-13,ABC RETAIL,105000.00
  </code></pre>
  
  <p>Sample output : </p>
  
  <pre><code>100.0
  
  400.0
  
  0.0
  
  135.0
  
  0.0
  
  1.0
  
  0.0
  
  550.0
  
  0.0
  
  1050.0
  </code></pre>
  
  <p>Output Explained : </p>
  
  <pre><code>100.0 (Rule 3 applied)
  
  400.0 (Rule 3 applied)
  
  0.0   (Rule 5 applied for June for ABC RETAIL)
  
  135.0 (Rule 2 applied)
  
  0.0   (Rule 5 applied for July for ABC RETAIL)
  
  1.0   (Rule 4 and 6 applied)
  
  0.0   (Rule 5 applied for August for XYZ RETAIL)
  
  550.0 (Rule 3 Applied)
  
  0.0   (Rule 5 applied for August for xyz RETAIL)
  
  1050.0 (Rule 3 Applied)
  </code></pre>
  
  <p>My code is as follows:</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.util.*;
  class Merchant
  {
      ArrayList&lt;Transaction&gt; listTrans;
      String name;
  
      Merchant(String n)
      {
          listTrans=new ArrayList&lt;Transaction&gt; ();
          name=n;
      }
  }
  class Transaction
  {
      int date;
      int month;
      int year;
      double amount;
      double charge;
  }
  
  public class TestClass{
      public static void main(String[] args) {
  
          HashMap&lt;String,Merchant&gt; merchantMap=new HashMap&lt;String,Merchant&gt;();
          Merchant merch=null;
          String[] trans=new String[3];
          String[] date=new String[3];
  
          BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
          String line=null;
          try
          {
              line=br.readLine();
          }
          catch(IOException e)
          {
                      e.printStackTrace();
          }
  
          int N=Integer.parseInt(line);
          for(int i=0;i&lt;N;i++)
          {
              System.out.println("i = "+i);
              try
              {
                  line=br.readLine();
              }
              catch(IOException e)
              {
                      e.printStackTrace();
              }
              trans=line.split(",");
              date=trans[0].split("-");
              merch=merchantMap.get(trans[1]);
              if(merch==null)
              {
                  merchantMap.put(trans[1],new Merchant(trans[1]));
                  merch=merchantMap.get(trans[1]);
              }
              Transaction t=new Transaction();
              t.date=Integer.parseInt(date[2]);
              t.month=Integer.parseInt(date[1]);
              t.year=Integer.parseInt(date[0]);
              t.amount=Double.parseDouble(trans[2]);
              int countFree=0;
              double totalAmount=0;
              for(Transaction tr:merch.listTrans)
              {
                  if(tr.year==t.year)
                  {
                      if(tr.month==t.month)
                      {
                          totalAmount+=tr.amount;
                          if(tr.amount&lt;=5000)
                          countFree++;           
                      }
                  }
              }
              if(countFree&lt;2 &amp;&amp; t.amount&lt;=5000)
              {
                  t.charge=0.00;
                   System.out.println("FREE RULE APPLIED");
              }
              else if(totalAmount&gt;=50000)
              {
                  t.charge=Math.ceil(t.amount*(0.5/100));
                  System.out.println("0.5 Applied.total amt&gt;50000");
              }
              else
              {
                  if(t.amount&lt;5000)
                  {
                      t.charge=Math.ceil(t.amount*(2.0/100));
                      System.out.println("2.0 Applied.amt&lt;5000");
                  }
                  else if(t.amount&gt;=5000 &amp;&amp; t.amount&lt;=9999.99)
                  {
                      t.charge=Math.ceil(t.amount*(1.5/100));
                      System.out.println("1.5 Applied.amt=&gt;5000..&lt;=9999.99");
                  }
                  else
                  {
                      t.charge=Math.ceil(t.amount*(1.0/100));
                      System.out.println("1.0 Applied.amt&gt;10,000");
                  }
              }
                  merch.listTrans.add(t);
                  System.out.println(t.charge);
                  merch=null;   
          }   
      }
  }
  </code></pre>