title: Java Exercise Solving Problem - Control Structures
body: <p>Acquire the grades of pupils in a class from the keyboard by storing the data in a vector. The number N of students must be entered from the keyboard. Validation of the number of students (n between 1 and 35) and of the marks entered (grade between 1 and 10) is required</p>
  <p>PROBLEM : When I enter a wrong grade, it gives me the opportunity to re-enter the correct value. But if I re-enter the wrong value, it won't give me the option to enter the correct value again. In other words, he has to give me the option to re-enter the value until I type the wrong vote</p>
  <pre class="lang-java prettyprint-override"><code>package es;
  
  import java.util.ArrayList;
  import java.util.Scanner;
      
  public class es2 {
  
      public static void main(String[] args) {
          Scanner tastiera = new Scanner(System.in);
          int alunni[] = new int[35];
          int valore_voto = 0;
          int somma_voti = 0;
          int numero_voti = 0;
          float media = 0;
      
          System.out.println(&quot;Inserisci numero voti&quot;);
          numero_voti = tastiera.nextInt();
      
          int i;
      
          for (i = 0; i &lt; numero_voti; i++) {
              System.out.println(&quot;Inserisci valore voto&quot;);
              valore_voto = tastiera.nextInt();
      
              if (valore_voto &gt;= 1 &amp;&amp; valore_voto &lt;= 10) {
                  alunni[i] = valore_voto;
              } else {
                  System.out.println(&quot;Inserisci voto corretto&quot;);
                  while (valore_voto &lt;= 1 &amp;&amp; valore_voto &gt;= 10);
              }
          }
      }
  }
  </code></pre>