title: IllegalArgumentException Not functioning Correctly in Java
body: <p>So throwing Illegal Exceptions is new to me and I was hoping for some pointers in it. I was making a code that will determine the amount of money generated or lost in an event, however, I was getting 2 errors in the code while testing. The first would be no matter what I input, I would receive the <code>IllegalArgumentException</code> error message "Exception in thread "main" <code>java.lang.IllegalArgumentException</code>: The letter chosen is invalid.Must be T, D, or E. The given data T will be ignored." I'm not quite sure why as even the message is saying that I was using the correct letter. </p>
  
  <p>The second issue I was having was that my program was not actually showing values (aside from 0) in my display method. I felt like I had the correct idea so I thought maybe I did this incorrectly elsewhere. I did attach the entire code if needed, but I left a comment where I felt the error was. </p>
  
  <pre><code>public class EdmondEventManager2 {
  
          /**Purpose of code is to determine the amount of money generated or  lost in an event
           * @param args the command line arguments
           */
          public static void main(String[] args) {
              EdmondEventClass object= new EdmondEventClass();
  
              object.addNewValue(amountType(),validateAmount());
              object.displayResults();
          }
  
          /*static method that will read and validate amount type T-ticket sales, D-Donation, E-expenses */
          public static char amountType (){
              Scanner keyboard= new Scanner (System.in);
              System.out.println("Please select the amount Type: T-Ticket Sales,"
                           + " D-Donations, E-Expenses");
              char amtType=keyboard.next().charAt(0);
              amtType=Character.toUpperCase(amtType);
  
              switch(amtType)
              {
                  case 'T' &amp;'t':
                      break;
                  case 'D'&amp; 'd'  :
                      break;
                  case 'E' &amp;'e' :
                      break;
              }
  
              if (amtType !='T'&amp;&amp; amtType!='D'&amp;&amp; amtType!='E'&amp;&amp;amtType!='t'
                    &amp;&amp;amtType!='d'&amp;&amp;amtType!='e'){
                do {       
                    System.out.println("Choice invalid. Please select T, D, or E");
                    System.out.println("Enter amount type: T, D, or E.");
                    amtType=keyboard.next().charAt(0);   
                }while (amtType!='T'&amp;&amp;amtType!='D'&amp;&amp;amtType!='E');
                return amtType= Character.toUpperCase(amtType);
              }
  
              return amtType= Character.toUpperCase(amtType);
        }
  
        /*static method that will read and validate the amount. I believe te first  issue is here */
        public static double validateAmount (){
           Scanner keyboard= new Scanner (System.in);
           System.out.println("Please enter the amount in dollars");
           double amount=keyboard.nextInt();
  
           if (amount&lt;=0){
               do {       
                   System.out.println("Amount must be a positive number!"
                       + " Try Again");
                   System.out.println("Please enter the amount in dollars");
                   amount=keyboard.nextInt();   
              }while (amount&lt;=0);
                   return amount;
           }
  
           return amount;                
        }
  
        public static class EdmondEventClass{
          private int T;
          private int D;
          private int E;
  
          //constructors   
          public EdmondEventClass (){    
              T=0;
              D=0;
              E=0;    
          }
  
          //getters
          public int getTotalIncomeSale () {
              return this.T;
          }
  
          public int getTotalDonatins () {
              return this.D;
          }
  
          public int getTotalExpenses (){
              return this.E;
          }
  
          /*Instance method that will add a new value to one of the totals
           *@char amtType- One of the letters the user must chose. T-ticket sales,
            D-Donation, E-expenses
          *@ double amount- the amount for the chosen amtType.    
          */
          public double addNewValue ( char amtType, double amount) {
  
              if (amount&lt;=0) {
                   throw new IllegalArgumentException("Amount must be positive and "
                 + "non-zero. The given data " +amount+ " will be ignored.");
              }
              else if (amtType !=T&amp;&amp; amtType!=D&amp;&amp; amtType!=E ) {
                  throw new IllegalArgumentException ("The letter chosen is invalid."
                     + "Must be T, D, or E. The given data " +amtType+ 
                     " will be ignored");
              }
  
              return amount + amtType;
          }
  
          //Will display the outcome of the event. I believe the second issue is here.
          public double  displayResults (){
              System.out.println ("Event Overall Outcome:");
              System.out.println ("Total ticket sales:     "+T);
              System.out.println ("Total donations:        "+D+ "  +");
              System.out.println ("                     -------");
              System.out.println ("Total income:    ");
              System.out.println ("Total expense:          "+E+ "  -");
              System.out.println ("                     -------");
              System.out.println ("Event profits:    ");
              String numberString=String.format ("%8.2f");
              return T+D;    
          }
      }
  }
  </code></pre>