中国大学MOOC-JAVA学习(浙大翁恺)—— 信号报告
Posted 硬盘红了
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了中国大学MOOC-JAVA学习(浙大翁恺)—— 信号报告相关的知识,希望对你有一定的参考价值。
使用switch-case语句的练习
1 import java.util.Scanner; 2 3 public class Main 4 { 5 6 public static void main(String[] args) 7 { 8 // TODO Auto-generated method stub 9 Scanner in = new Scanner(System.in); 10 int i; 11 int j; 12 int k; 13 i = in.nextInt(); 14 j = i/10; 15 k = i%10; 16 switch (k) 17 { 18 case 1: 19 System.out.print("Faint signals, barely perceptible"); 20 break; 21 case 2: 22 System.out.print("Very weak signals"); 23 break; 24 case 3: 25 System.out.print("Weak signals"); 26 break; 27 case 4: 28 System.out.print("Fair signals"); 29 break; 30 case 5: 31 System.out.print("Fairly good signals"); 32 break; 33 case 6: 34 System.out.print("Good signals"); 35 break; 36 case 7: 37 System.out.print("Moderately strong signals"); 38 break; 39 case 8: 40 System.out.print("Strong signals"); 41 break; 42 case 9: 43 System.out.print("Extremely strong signals"); 44 break; 45 } 46 System.out.print(", "); 47 switch (j) 48 { 49 case 1: 50 System.out.print("unreadable"); 51 break; 52 case 2: 53 System.out.print("barely readable, occasional words distinguishable"); 54 break; 55 case 3: 56 System.out.print("readable with considerable difficulty"); 57 break; 58 case 4: 59 System.out.print("readable with practically no difficulty"); 60 break; 61 case 5: 62 System.out.print("perfectly readable"); 63 break; 64 } 65 System.out.print("."); 66 } 67 }
以上是关于中国大学MOOC-JAVA学习(浙大翁恺)—— 信号报告的主要内容,如果未能解决你的问题,请参考以下文章