Getting List of Words Input for Word Search Generator












0














In this program, this user will have the opportunity to generate their own word search. In the beginning of the program, the user will be shown a menu of instructions in which they can choose between these options:
1. Create a word search
2. Print the word search
3. View solutions to the word search
4. Exit the program



When choosing to create a word search, the user is asked to enter words of their choice, line by line. These words will be stored in a 1-D array.



The user will have to enter a minimum of 20 words, maximum at 260. At every batch of 20 words, the user will be asked if they want to add more words. If the user chooses to add more words, the program will prompt him/her to enter more words until they have reached the max number of words.



If they choose to stop adding more words, the program will jump right into converting the 1-D array to an Array List, and then create the word search, which is where I am having a little problem at.






if (choice == 1) {

System.out.println("Enter words of your choice line-by-line. You can enter a maximum of 260 words (i.e., 10 words per letter)");

System.out.println("");

String wordList = new String[260];

// This for loop will loop around with it`s body the user decides they have added enough words and wish to proceed

for (int i = 0; i < wordList.length; i++) {

wordList[i] = input.nextLine();

if (wordList[i] == wordList[19] || wordList[i] == wordList[39] || wordList[i] == wordList[59] || wordList[i] == wordList[79] || wordList[i] == wordList[99] || wordList[i] == wordList[119]|| wordList[i] == wordList[139]) {

System.out.print("Do you want to keep adding words? Enter Y/N: ");
String answer = input.next().toUpperCase();

if (answer == "Y") {

wordList[i] = input.nextLine();

} if (answer == "N") {

break;

}//end of inner if

}//end of outer if

}//end of for loop

List<String> words = Arrays.asList(wordList);

createWordSearch(words);





When the user types in "N," the program is supposed to end the for loop and jump right into the part after }//end of for loop. Ive added 'break;' in order to stop the loop, but instead Im pretty sure it is stopping the entire program from proceeding. When I remove the 'break;' the program keeps prompting me to add more words (basically until there are 260 words added in total).










share|improve this question







New contributor




Yashvi Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0














    In this program, this user will have the opportunity to generate their own word search. In the beginning of the program, the user will be shown a menu of instructions in which they can choose between these options:
    1. Create a word search
    2. Print the word search
    3. View solutions to the word search
    4. Exit the program



    When choosing to create a word search, the user is asked to enter words of their choice, line by line. These words will be stored in a 1-D array.



    The user will have to enter a minimum of 20 words, maximum at 260. At every batch of 20 words, the user will be asked if they want to add more words. If the user chooses to add more words, the program will prompt him/her to enter more words until they have reached the max number of words.



    If they choose to stop adding more words, the program will jump right into converting the 1-D array to an Array List, and then create the word search, which is where I am having a little problem at.






    if (choice == 1) {

    System.out.println("Enter words of your choice line-by-line. You can enter a maximum of 260 words (i.e., 10 words per letter)");

    System.out.println("");

    String wordList = new String[260];

    // This for loop will loop around with it`s body the user decides they have added enough words and wish to proceed

    for (int i = 0; i < wordList.length; i++) {

    wordList[i] = input.nextLine();

    if (wordList[i] == wordList[19] || wordList[i] == wordList[39] || wordList[i] == wordList[59] || wordList[i] == wordList[79] || wordList[i] == wordList[99] || wordList[i] == wordList[119]|| wordList[i] == wordList[139]) {

    System.out.print("Do you want to keep adding words? Enter Y/N: ");
    String answer = input.next().toUpperCase();

    if (answer == "Y") {

    wordList[i] = input.nextLine();

    } if (answer == "N") {

    break;

    }//end of inner if

    }//end of outer if

    }//end of for loop

    List<String> words = Arrays.asList(wordList);

    createWordSearch(words);





    When the user types in "N," the program is supposed to end the for loop and jump right into the part after }//end of for loop. Ive added 'break;' in order to stop the loop, but instead Im pretty sure it is stopping the entire program from proceeding. When I remove the 'break;' the program keeps prompting me to add more words (basically until there are 260 words added in total).










    share|improve this question







    New contributor




    Yashvi Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0







      In this program, this user will have the opportunity to generate their own word search. In the beginning of the program, the user will be shown a menu of instructions in which they can choose between these options:
      1. Create a word search
      2. Print the word search
      3. View solutions to the word search
      4. Exit the program



      When choosing to create a word search, the user is asked to enter words of their choice, line by line. These words will be stored in a 1-D array.



      The user will have to enter a minimum of 20 words, maximum at 260. At every batch of 20 words, the user will be asked if they want to add more words. If the user chooses to add more words, the program will prompt him/her to enter more words until they have reached the max number of words.



      If they choose to stop adding more words, the program will jump right into converting the 1-D array to an Array List, and then create the word search, which is where I am having a little problem at.






      if (choice == 1) {

      System.out.println("Enter words of your choice line-by-line. You can enter a maximum of 260 words (i.e., 10 words per letter)");

      System.out.println("");

      String wordList = new String[260];

      // This for loop will loop around with it`s body the user decides they have added enough words and wish to proceed

      for (int i = 0; i < wordList.length; i++) {

      wordList[i] = input.nextLine();

      if (wordList[i] == wordList[19] || wordList[i] == wordList[39] || wordList[i] == wordList[59] || wordList[i] == wordList[79] || wordList[i] == wordList[99] || wordList[i] == wordList[119]|| wordList[i] == wordList[139]) {

      System.out.print("Do you want to keep adding words? Enter Y/N: ");
      String answer = input.next().toUpperCase();

      if (answer == "Y") {

      wordList[i] = input.nextLine();

      } if (answer == "N") {

      break;

      }//end of inner if

      }//end of outer if

      }//end of for loop

      List<String> words = Arrays.asList(wordList);

      createWordSearch(words);





      When the user types in "N," the program is supposed to end the for loop and jump right into the part after }//end of for loop. Ive added 'break;' in order to stop the loop, but instead Im pretty sure it is stopping the entire program from proceeding. When I remove the 'break;' the program keeps prompting me to add more words (basically until there are 260 words added in total).










      share|improve this question







      New contributor




      Yashvi Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      In this program, this user will have the opportunity to generate their own word search. In the beginning of the program, the user will be shown a menu of instructions in which they can choose between these options:
      1. Create a word search
      2. Print the word search
      3. View solutions to the word search
      4. Exit the program



      When choosing to create a word search, the user is asked to enter words of their choice, line by line. These words will be stored in a 1-D array.



      The user will have to enter a minimum of 20 words, maximum at 260. At every batch of 20 words, the user will be asked if they want to add more words. If the user chooses to add more words, the program will prompt him/her to enter more words until they have reached the max number of words.



      If they choose to stop adding more words, the program will jump right into converting the 1-D array to an Array List, and then create the word search, which is where I am having a little problem at.






      if (choice == 1) {

      System.out.println("Enter words of your choice line-by-line. You can enter a maximum of 260 words (i.e., 10 words per letter)");

      System.out.println("");

      String wordList = new String[260];

      // This for loop will loop around with it`s body the user decides they have added enough words and wish to proceed

      for (int i = 0; i < wordList.length; i++) {

      wordList[i] = input.nextLine();

      if (wordList[i] == wordList[19] || wordList[i] == wordList[39] || wordList[i] == wordList[59] || wordList[i] == wordList[79] || wordList[i] == wordList[99] || wordList[i] == wordList[119]|| wordList[i] == wordList[139]) {

      System.out.print("Do you want to keep adding words? Enter Y/N: ");
      String answer = input.next().toUpperCase();

      if (answer == "Y") {

      wordList[i] = input.nextLine();

      } if (answer == "N") {

      break;

      }//end of inner if

      }//end of outer if

      }//end of for loop

      List<String> words = Arrays.asList(wordList);

      createWordSearch(words);





      When the user types in "N," the program is supposed to end the for loop and jump right into the part after }//end of for loop. Ive added 'break;' in order to stop the loop, but instead Im pretty sure it is stopping the entire program from proceeding. When I remove the 'break;' the program keeps prompting me to add more words (basically until there are 260 words added in total).






      if (choice == 1) {

      System.out.println("Enter words of your choice line-by-line. You can enter a maximum of 260 words (i.e., 10 words per letter)");

      System.out.println("");

      String wordList = new String[260];

      // This for loop will loop around with it`s body the user decides they have added enough words and wish to proceed

      for (int i = 0; i < wordList.length; i++) {

      wordList[i] = input.nextLine();

      if (wordList[i] == wordList[19] || wordList[i] == wordList[39] || wordList[i] == wordList[59] || wordList[i] == wordList[79] || wordList[i] == wordList[99] || wordList[i] == wordList[119]|| wordList[i] == wordList[139]) {

      System.out.print("Do you want to keep adding words? Enter Y/N: ");
      String answer = input.next().toUpperCase();

      if (answer == "Y") {

      wordList[i] = input.nextLine();

      } if (answer == "N") {

      break;

      }//end of inner if

      }//end of outer if

      }//end of for loop

      List<String> words = Arrays.asList(wordList);

      createWordSearch(words);





      if (choice == 1) {

      System.out.println("Enter words of your choice line-by-line. You can enter a maximum of 260 words (i.e., 10 words per letter)");

      System.out.println("");

      String wordList = new String[260];

      // This for loop will loop around with it`s body the user decides they have added enough words and wish to proceed

      for (int i = 0; i < wordList.length; i++) {

      wordList[i] = input.nextLine();

      if (wordList[i] == wordList[19] || wordList[i] == wordList[39] || wordList[i] == wordList[59] || wordList[i] == wordList[79] || wordList[i] == wordList[99] || wordList[i] == wordList[119]|| wordList[i] == wordList[139]) {

      System.out.print("Do you want to keep adding words? Enter Y/N: ");
      String answer = input.next().toUpperCase();

      if (answer == "Y") {

      wordList[i] = input.nextLine();

      } if (answer == "N") {

      break;

      }//end of inner if

      }//end of outer if

      }//end of for loop

      List<String> words = Arrays.asList(wordList);

      createWordSearch(words);






      java javascript beginner array






      share|improve this question







      New contributor




      Yashvi Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      Yashvi Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      Yashvi Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 26 mins ago









      Yashvi Shah

      11




      11




      New contributor




      Yashvi Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Yashvi Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Yashvi Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "196"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Yashvi Shah is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f210923%2fgetting-list-of-words-input-for-word-search-generator%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Yashvi Shah is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Yashvi Shah is a new contributor. Be nice, and check out our Code of Conduct.













          Yashvi Shah is a new contributor. Be nice, and check out our Code of Conduct.












          Yashvi Shah is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Code Review Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f210923%2fgetting-list-of-words-input-for-word-search-generator%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Ottavio Pratesi

          Tricia Helfer

          15 giugno