0

So my code is supposed to display a dialog box that has choices on it and the user is supposed to choose. Whichever the user chooses, it will display a certain portion of a file as an array, which then sparks another choice for the user out of that portion. I don't know exactly what I am doing and I have tried everything to the best of my knowledge.

ArrayList<String> position = new ArrayList<String>();
int pick = 1;
boolean checkForSameStrings = false;

for(int pickCount = 0; pickCount < numOfTeams; pickCount++) 
{ 
    String pickPosition = JOptionPane.showInputDialog(null, "What position do you plan on drafting?");
    for(int checkForSameArrayStrings = 0; checkForSameArrayStrings < positionLabel.size(); checkForSameArrayStrings++) 
    {
        while(numOfTeams.equals(position.get(checkForSameArrayStrings))) 
        {
            String nextPick;
            checkForSameStrings = true;
            nextPick = JOptionPane.showInputDialog(null, "Please enter a different team
            position " + pick);
            break;
        }
    }

    position.add(pickPosition);
    System.out.println(position.get(pickCount));

    pick++;

}   
dan1st
  • 12,568
  • 8
  • 34
  • 67
  • Just a couple general comments about code style: industry standard is to use `i` and `j` for for loop iteration variables. Also, `pickPosition` sounds like an int, but yours is a string. Lastly, booleans are usually `isSomething` or similar, so for `checkForSameStrings` perhaps use `isCheckingForSame` or something like that. – Luke Willis Mar 02 '14 at 04:08
  • **I don't know exactly what I am doing and I have tried everything to the best of my knowledge** than how would you make us understand where are you stuck? – Sanjeev Mar 02 '14 at 04:24

0 Answers0