/**
 * Steven Ward
 * WardDuplicate.java | Duplicate Project
 *
 * A program to validate a user-input array and output information about duplicate elements.
 * This program first prompts the user to enter the number of elements they intend to input. This
 * number is validated to ensure that it is greater than or equal to 15, and the program will prompt
 * the user for another number (this cycle is repeated until a valid number is given); from now on,
 * this number will be referred to as 'N'. Once the user has entered a legal value for N, he/she
 * will be prompted, one at a time, for N integer elements. Each element must be an integer value on
 * the interval, [1,N] (note: this range is inclusive), and if it is not, the user will be
 * prompted repeatedly until an acceptable value has been input. Once the array has been populated
 * with N valid elements, this program presents an output containing the following information:
 *     a) the array elements given by the user (i.e. "the array")
 *     b) the elements, if any, that were duplicated
 *     c) if there are duplicate values, those values and the number of times they were duplicated.
 * When the user closes this final output window, the program will terminate.
 *
 * Due Date: October 2, 2016
 *
 * @see #main(String[] args)
 * TODO: Add 'see' tags for the methods in this program
 *       Add any additional tags as needed
 */

import javax.swing.JOptionPane;

public class WardDuplicate {

  private static boolean tryParseInt(String value) {
    try {
      Integer.parseInt(value);
      // If 'value' did not represent a valid 'int', then the above threw an exception and the
      // following line is not executed.
      return true;
    }
    catch (NumberFormatException nfe) {  // If 'Integer.parseInt' throws, execution jumps here.
      return false;
    }
  }


  private static int[] getElements(int[] userArray, int index) {

    if (index >= userArray.length) {
      return userArray;
    }
    else {
      String title = "Element " + (index + 1) + " of " + userArray.length;
      String message = "Please enter a number between 1 and " + userArray.length;
    }
  }
}

@@ -2149,16 +2149,707 @@
 th;%0A    
-%7D%0A  %7D
+  String elementStr = JOptionPane.showInputDialog(null, message, title, JOptionPane.QUESTION_MESSAGE);%0A%0A      while (!tryParseInt(elementStr) %7C%7C Integer.parseInt(elementStr) %3C 1 %7C%7C Integer.parseInt(elementStr) %3E userArray.length) %7B%0A        String errTitle = %22Invalid Element!%22;%0A        elementStr = JOptionPane.showInputDialog(null, message, title, JOptionPane.ERROR_MESSAGE);%0A      %7D%0A      userArray%5Bindex%5D = Integer.parseInt(elementStr);%0A      return getElements(userArray, ++index);%0A    %7D%0A  %7D%0A%0A%0A  private static String toString(int%5B%5D array) %7B%0A    String arrayStr = %22%5B %22;%0A    for (int element : array) %7B%0A      arrayStr += Integer.toString(element) + %22 %22;%0A    %7D%0A    return arrayStr + %22 %5D%22;%0A  %7D%0A%0A
 %0A%7D%0A

Update Working Version of 'WardDuplicate.java'