title: How to set limit on input from 0-100 Java
body: <p>So this is my code: I need to set a limit on the input of the grades in the switch statement so that it will not go over 100 and under 0. If anyone could help, that would be incredible. Thanks.</p>
  
  <pre><code>import java.util.Scanner; 
   public class assigment1{
  
  static Scanner key = new Scanner(System.in);
    public static void main(String[] args){
       int number;
  
       System.out.println("Student Grade System");
       System.out.println("====================");
       System.out.println("");
       System.out.println("   1) Enter student details");
       System.out.println("   2) Dsiplay student grades");
       System.out.println("   3) Display student statistics");
       System.out.println("   4) Display full transcript");
       System.out.println("   0)Exit system");
       System.out.println("   ");
       System.out.print("Select an option [0-4]&gt;&gt;");
  
       Scanner input= new Scanner(System.in);
       number=input.nextInt();
  
        switch(number){
          case 1:
            System.out.print("Entering Student Detials");
            System.out.print("========================");
            System.out.print("    Student number:                ");String a =key.nextLine();
            System.out.print("    Programing Grade:              ");number=input.nextInt();
            System.out.print("    web Development Grade:         ");number=input.nextInt();
            System.out.print("    Mathematics Grade:             ");number=input.nextInt();
            System.out.print("    Critical Thinking Grade:       ");number=input.nextInt();
            System.out.print("    Operating System Grade:        ");number=input.nextInt();
            System.out.print("    Computer Archetecture Grade:   ");number=input.nextInt();
            break;
          case 2:
            System.out.println("Display stuent grades");
            break;
          case 3:
            System.out.println("Display student statistics");
            break;
          case 4:
            System.out.println("Display full transcript");
            break;
          default:
            System.out.println("Thanks for using the system");
            break;
  </code></pre>