title: the output should display a hyphen (-) after the first 3 digits and subsequently a hyphen after every 4 digits
body: <p>I have an assignment but i couldn't complete this question.
  Previously I add inserted else if (counter == 7) { break; } after the counter==3 but I had removed since the question said to process as many digits as the user wants.</p>
  
  <p>I do not know how to add to count every 4 digit for dash after the first 3 digits dash.</p>
  
  <p>the code below is what I have.</p>
  
  <p>please help and explain to me if possible. thanks :) </p>
  
  <p>import java.util.Scanner;</p>
  
  <p>public class question1 {</p>
  
  <pre><code>public static void main (String [] args)
  {
      boolean notletter = false;
      Scanner console = new Scanner(System.in);
      String phoneletter = "";
      int counter = 0;
  
      System.out.print("Enter a phone number in letters only: ");
      String phoneNumber = console.nextLine();
  
      String phnum2 = phoneNumber.replaceAll(" ", "");
  
      for (int i = 0; i &lt;= phnum2.length() - 1; i++) {
  
          if (!(Character.isLetter(phnum2.charAt(i)))) {
              notletter = true;
  
              break;
          }
          {
  
              switch (Character.toUpperCase(phnum2.charAt(i))) {
                  case 'A':
                  case 'B':
                  case 'C':
                      phoneletter = phoneletter + "2";
                      break;
                  case 'D':
                  case 'E':
                  case 'F':
                      phoneletter = phoneletter + "3";
                      break;
                  case 'G':
                  case 'H':
                  case 'I':
                      phoneletter = phoneletter + "4";
                      break;
                  case 'J':
                  case 'K':
                  case 'L':
                      phoneletter = phoneletter + "5";
                      break;
                  case 'M':
                  case 'N':
                  case 'O':
                      phoneletter = phoneletter + "6";
                      break;
                  case 'P':
                  case 'Q':
                  case 'R':
                  case 'S':
                      phoneletter = phoneletter + "7";
                      break;
                  case 'T':
                  case 'U':
                  case 'V':
                      phoneletter = phoneletter + "8";
                      break;
                  case 'W':
                  case 'X':
                  case 'Y':
                  case 'Z':
                      phoneletter = phoneletter + "9";
                      break;
  
              }
              counter++;
  
              if (counter ==3) {
  
                  phoneletter = phoneletter + "-";
  
  
                  }
  
  
              }
  
  
          }
  
  
  
      if (notletter == true) {
          System.out.println("Please indicate only alphabets");
      } else {
          System.out.println(phoneletter);
      }
  
  }
  </code></pre>
  
  <p>}</p>