总结:从键盘输入分数-----

如果在0到100内,则输出等级    

小于0或者是大于100都不能输出,这里用if-else条件判断。

 

package com.c2;

import java.util.Scanner; 
 
/** 
 * 
 * @author Administrator 
 */ public class Olk{ 
 
    /** 
     * @param args the command line arguments 
     */ 
    public static void main(String[] args) { 
        Scanner c=new Scanner(System.in);
        System.out.println("请输入你的分数-----");
        int x=c.nextInt();
        if(x>0&&x<100){
        	
        
        switch(x/10){
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
        	System.out.println("E");
        	break;
        case 6:
       System.out.println("D");
       break;
        case 7:
        	System.out.println("c");
        	break;
        case 8:
        	System.out.println("B");
        	break;
        case 9:
        
     
        case 10:
    		System.out.println("A");
       break;
       default:
    	   break;
       
        }
        
        }
        else {
        	System.out.println("无效");
        }
    	
    	
    	
}
}

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-08
  • 2021-11-29
  • 2021-05-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-13
  • 2022-12-23
  • 2021-07-06
  • 2021-06-25
  • 2022-01-06
  • 2021-09-24
相关资源
相似解决方案