1 with a switch statement input from the console 100 within the score judgment excellent, good, pass a section which belongs to fail

public static void main(String[] args) {

      System.out.println ( " Please enter the grade ");

      Scanner scanner=new Scanner(System.in);

      int num=scanner.nextInt();

           switch(num/10) {

           case 10:

                     System.out.println ( " out ");

                     break;

           case 9:

                     System.out.println ( " achievement is outstanding ");

                     break;

           case 8:

           case 7:

                     System.out.println ( " score of good show ");

                     break;

           case 6:

                      System.out.println ( " score of passing show ");

                     break;

            case 0:

            case 1:

            case 2:

            case 3:

            case 4:

            case 5:

                      System.out.println ( " score of failing ");

                      break;

            default:

                      System.out.println ( " Please enter a valid result ");

                      break;

            }

            scanner.close();

            }

Guess you like

Origin blog.csdn.net/weixin_40873693/article/details/78472291