title: Statement in a for loop executing only once
body: <pre><code>import java.util.Scanner;
  
  public class Test {
  
      public static void main(String args[]) {
          String name = " ", n;
          double r, h, s, m = 0;
          int c;
  
          Scanner i = new Scanner(System.in);
          Employee e[] = new Employee[5];
  
          for (int j = 0; j &lt; 5; j++) {
              System.out.printf("\nPlease enter the name of Employee %d ", j + 1);
              /* THE PROBLEM LIES IN THE ABOVE STATEMENT IT IS EXECUTED ONLY ONCE WHILE IT'S MEANT TO BE EXECUTED 5 TIMES */
              n = i.nextLine();
              System.out.print("\t1.PartTime\n\t2.FullTime\n");
              c = i.nextInt();
  
              switch (c) {
                  case 1:
                      System.out.print("hours worked ");
                      h = i.nextDouble();
                      System.out.print("rate per hour ");
                      r = i.nextDouble();
                      e[j] = new Part(n, h, r);
                      break;
                  case 2:
                      System.out.print("Salary ");
                      s = i.nextDouble();
                      e[j] = new Full(n, s);
                      break;
                  default:
                      System.out.print("\n***INVALID*** ");
                      j--;
              }
          }
      }
  }
  </code></pre>