UNB/ CS/ David Bremner/ teaching/ java/ Remove2.java
public class Remove2
{  public static void main(String[] args)
   {  ConsoleReader console = new ConsoleReader(System.in);

      String[] staff = new String[5];
      staff[0] = "Dick";
      staff[1] = "Harry";
      staff[2] = "Juliet";
      staff[3] = "Romeo";
      staff[4] = "Tom";
      int staffSize = staff.length;

      print(staff, staffSize);

      System.out.println("Remove which element? (0 - 4)");
      int pos = console.readInt();

      // shift all elements above pos down

      for (int i = pos; i < staffSize - 1; i++)
         staff[i] = staff[i + 1];

      staffSize--;
      
      print(staff, staffSize);
   }
   
   /**
      Prints an array of strings
      @param s the string array
      @param sSize the number of strings in the array
   */
   public static void print(String[] s, int sSize)
   {  for (int i = 0; i < sSize; i++)
         System.out.println(i + ": " + s[i]);
   }
}