title: If else statements not working- why?
body: <p>After working on this code for a while and coming very close to the end, I've run into an unexpected problem.  The if and else statements for choices 'B' and 'C' display nothing on the screen when they are typed in as user input.  I've tried a few things but I cannot seem to figure it out.</p>
  
  <pre class="lang-java prettyprint-override"><code>import java.util.Scanner;
  public class Internet_Service_Provider
  {
      public static void main(String[] args)
      {
          double hours;
          char choice;
  
          Scanner input = new Scanner(System.in);
  
          System.out.println ("Enter the letter of your package: ");
          choice = input.nextLine().charAt(0);
  
          System.out.println ("Enter the number of hours used: ");
          hours = input.nextDouble();
  
          double chargesa, chargesb, chargesc;
          chargesa = 9.95;
          chargesb = 13.95;
          chargesc = 19.95;
  
          double chargesa2, chargesb2;
          chargesa2 = (hours - 10) * 2;
          chargesb2 = (hours - 20);
  
          double extrafeesA, extrafeesB;
          extrafeesA = chargesa + chargesa2;
          extrafeesB = chargesb + chargesb2;
  
          if (choice == 'A')
              if (hours &lt;= 10) { 
                  System.out.println ("Your total charges are: " + chargesa);
              }
          else if (choice == 'A')
              if (hours &gt; 10){
                   System.out.println ("your total charges are: " + extrafeesA);
               }
          else if (choice == 'B')
              if (hours &lt;= 20) {
                   System.out.println ("Your total charges are: " + chargesb);
              }
          else if (choice == 'B')
              if (hours &gt; 20){
                   System.out.println ("Your total charges are: " + extrafeesB);
              }
          else if (choice == 'C'){
               System.out.println ("Your total charges are: " + chargesc);
          }
      }
  }
  </code></pre>
  
  <p>When the user types 'A' and then types the hours, the program runs perfectly and gives me the desired output.  If typing 'B' or 'C' and then the hours, there is no output onto the screen.  What is causing this?</p>
  
  <p>-EDIT- 
  I messed around with the code before checking the responses and discovered that if removing the else and creating this code:</p>
  
  <pre><code>  if (choice == 'A')
          if (hours &lt;= 10) { 
                System.out.println ("Your total charges are: " + chargesa);
          }
  
    if (choice == 'A')
          if (hours &gt; 10){
                System.out.println ("your total charges are: " + extrafeesA);
          }
  
    if (choice == 'B')
          if (hours &lt;= 20) {
                System.out.println ("Your total charges are: " + chargesb);
          }
  
    if (choice == 'B')
          if (hours &gt; 20){
                System.out.println ("Your total charges are: " + extrafeesB);
          }
  
    if (choice == 'C'){
          System.out.println ("Your total charges are: " + chargesc);}
  </code></pre>
  
  <p>... the program runs properly.  I guess the else statements were unnecessary and caused the problem.</p>