title: Is there any other way of code for the methods? It asks for user input n times based on a certain number
body: <p>I'm making this Study Schedule program and a part of it is where I ask how many Subjects does the user have, and then they say (for example) 5. Based on that number of subjects it will ask &quot;What is the name of the nth subject&quot; for how many subjects there are.</p>
  <p>I basically have the code written down already and it works, but is there anyway to simplify this? It feels chunky &amp; repetitive. Also, method names don't matter since this is just for testing.</p>
  <pre><code>import java.util.*;
  
  class NumberInput {
      public double NumberInput;
      public String SubjectName1;
      public String SubjectName2;
      public String SubjectName3;
      public String SubjectName4;
      public String SubjectName5;
      public String SubjectName6;
  
      public static void main(String[] args) {
          NumberInput wow = new NumberInput();
          wow.InputNumber();
          wow.InputString();
          wow.confirmResults();
      }
  
      public double DoubleInput(String numberQuestion) {
          Scanner input = new Scanner(System.in);
          System.out.println(numberQuestion);
          return input.nextDouble();
      }
  
      public String StringInput(String stringQuestion) {
          Scanner input = new Scanner(System.in);
          System.out.println(stringQuestion);
          return input.nextLine();
      }
  
      public double InputNumber() {
      NumberInput = DoubleInput(&quot;How many subjects would you like to study?&quot;);
      if (NumberInput &gt; 6) {
          System.out.println(&quot;Maximum Subjects exceeded. At the most, please answer 6&quot;);
      }
      return (NumberInput);
      }
  
      public void InputString() {
      if (NumberInput == 1) {
          SubjectName1 = StringInput(&quot;What is the name of the Subject: &quot;);
      }
  
      if (NumberInput == 2) {
          SubjectName1 = StringInput(&quot;What is the name of the Subject: &quot;);
          SubjectName2 = StringInput(&quot;What is the name of the second Subject: &quot;);
      }
  
      if (NumberInput == 3) {
          SubjectName1 = StringInput(&quot;What is the name of the Subject: &quot;);
          SubjectName2 = StringInput(&quot;What is the name of the second Subject: &quot;);
          SubjectName3 = StringInput(&quot;What is the name of the third Subject: &quot;);
      }
  
      if (NumberInput == 4) {
          SubjectName1 = StringInput(&quot;What is the name of the Subject: &quot;);
          SubjectName2 = StringInput(&quot;What is the name of the second Subject: &quot;);
          SubjectName3 = StringInput(&quot;What is the name of the third Subject: &quot;);
          SubjectName4 = StringInput(&quot;What is the name of the fourth Subject: &quot;);
      }
  
      if (NumberInput == 5) {
          SubjectName1 = StringInput(&quot;What is the name of the Subject: &quot;);
          SubjectName2 = StringInput(&quot;What is the name of the second Subject: &quot;);
          SubjectName3 = StringInput(&quot;What is the name of the third Subject: &quot;);
          SubjectName4 = StringInput(&quot;What is the name of the fourth Subject: &quot;);
          SubjectName5 = StringInput(&quot;What is the name of the fifth Subject: &quot;);
      }
  
      if (NumberInput == 6) {
          SubjectName1 = StringInput(&quot;What is the name of the Subject: &quot;);
          SubjectName2 = StringInput(&quot;What is the name of the second Subject: &quot;);
          SubjectName3 = StringInput(&quot;What is the name of the third Subject: &quot;);
          SubjectName4 = StringInput(&quot;What is the name of the fourth Subject: &quot;);
          SubjectName5 = StringInput(&quot;What is the name of the fifth Subject: &quot;);
          SubjectName6 = StringInput(&quot;What is the name of the sixth Subject: &quot;);
      }
  
      }
  
      public void confirmResults() {
          System.out.println(SubjectName1);
          System.out.println(SubjectName2);
          System.out.println(SubjectName3);
          System.out.println(SubjectName4);
          System.out.println(SubjectName5);
          System.out.println(SubjectName6);
      }
  
  }
  </code></pre>