dimanche 5 mars 2017

loop to generate words to until a user specified word is matched

I need to write a program that prompts a user for a word, then generates random strings of letters of that length until the word is generated and show how many tries it took. here is the code i have so far:

  System.out.println("(Match a word) Enter a word to be matched randomly: ");
         String userWord = input.next();
         String lowerUserWord = userWord.toLowerCase();   

         int wordLength = lowerUserWord.length();
            System.out.println("Your word has " + wordLength + " letters");

         while (lowerUserWord != ) {
           //somehow generate random words of the length 'wordLength'
        }




Aucun commentaire:

Enregistrer un commentaire