title: Help with breaking out of if/elses?
body: <p>I'm writing a protocol class, which includes a lot of if/elses..here's the class:</p>
  
  <pre><code>public class Protocol {
      Scanner scan = new Scanner(System.in);
      private static final int WAITING = 0;
      private static final int SENTREQUEST = 1;
      private static final int SENTITEMS = 2;
      private static final int ANOTHER = 3;
      private static final int CHOICE = 4;
      private int choice;
  
      private int state = WAITING;
  
  
  
      public String processInput(String theInput) {
          String theOutput = null;
  
          if (state == WAITING) {
              theOutput = "Do you accept the terms of agreement? Y/N?";
              state = SENTREQUEST;
          } else if (state == SENTREQUEST) {
              if (theInput.equalsIgnoreCase("y")) {
  
                theOutput = ": 1. program file 2. pictures 3. documentation";
                state = CHOICE;
               } else {
                  theOutput = "Invalid Input!";
                  state = SENTITEMS;
  
              }
  
          }
          else if (state == CHOICE) {
              choice = scan.nextInt();
              switch(choice) {
                  case 1: theOutput = "show something";
                  break;
                  case 2: theOutput = "show something";
                  break;
                  case 3: theOutput = "show something";
                  break;
              }
          }
          else if (state == SENTITEMS) {
  
                theOutput = "Want another? (y/n)";
                  state = ANOTHER;
  
          } else if (state == ANOTHER) {
  
                theOutput = "Do you accept the terms of agreement? Y/N?";
  
              if (theInput.equalsIgnoreCase("y")) {
                  theOutput ="test";
                  state = SENTREQUEST;
              } else {
                  theOutput = "Bye.";
                  state = WAITING;
              }
          }
          return theOutput;
      }
  }
  </code></pre>
  
  <p>It doesn't get to the switch case, and i'm sure it's an issue of breaking out of the if/elses clauses correctly but i can't find the issue.</p>