找高手做JAVA 里SWITCH 编程(题是英文的)
来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/07/07 16:11:19
找高手做JAVA 里SWITCH 编程(题是英文的)
Exercise on Switch Statement
For the following questions do:
1.Design a program that uses select case statement to determine the arithmetic operation on two numbers then display the output.For example any of the following letters can perform an arithmetic operation and display the output:
A is used to add two numbers
S is used to subtract two numbers
M is used to multiply two numbers
D is used to divide two numbers
2.Design a program that reads in a single digit number between 0-9 and
display it in English word,the program should display an error message if the number entered is less than 0 or greater than 9.
3.Design a program to determine grades in a course with three quizzes
(each quiz/test is out of 10).
Grades are determined by:
A is an average of 9 or better,
B is an average of 8,
C is an average of 7,
D is an average of 5 and 6
F is an average less than 5.
Display the grades and a message.
Exercise on Switch Statement
For the following questions do:
1.Design a program that uses select case statement to determine the arithmetic operation on two numbers then display the output.For example any of the following letters can perform an arithmetic operation and display the output:
A is used to add two numbers
S is used to subtract two numbers
M is used to multiply two numbers
D is used to divide two numbers
2.Design a program that reads in a single digit number between 0-9 and
display it in English word,the program should display an error message if the number entered is less than 0 or greater than 9.
3.Design a program to determine grades in a course with three quizzes
(each quiz/test is out of 10).
Grades are determined by:
A is an average of 9 or better,
B is an average of 8,
C is an average of 7,
D is an average of 5 and 6
F is an average less than 5.
Display the grades and a message.
![找高手做JAVA 里SWITCH 编程(题是英文的)](/uploads/image/z/6434686-46-6.jpg?t=%E6%89%BE%E9%AB%98%E6%89%8B%E5%81%9AJAVA+%E9%87%8CSWITCH+%E7%BC%96%E7%A8%8B%EF%BC%88%E9%A2%98%E6%98%AF%E8%8B%B1%E6%96%87%E7%9A%84%EF%BC%89)
1.
while(true)switch(System.in.read()){
case '\r':break;
case '\n':break;
case -1:break;
case 'A':System.out.println("A is used to add two numbers");break;
case 'S':System.out.println("S is used to subtract two numbers");break;
case 'M':System.out.println("M is used to multiply two numbers");break;
case 'D':System.out.println("D is used to divide two numbers");break;
default :System.out.println("Invalid Input");break;
}
2.
Scanner scn=new Scanner(System.in);
while(scn.hasNextInt())switch(scn.nextInt()){
case 0:System.out.println("ZERO");break;
case 1:System.out.println("ONE");break;
case 2:System.out.println("TWO");break;
case 3:System.out.println("THREE");break;
case 4:System.out.println("FOUR");break;
case 5:System.out.println("FIVE");break;
case 6:System.out.println("SIX");break;
case 7:System.out.println("SEVEN");break;
case 8:System.out.println("EIGHT");break;
case 9:System.out.println("NINE");break;
default :System.out.println("Invalid Input");break;
}
3.第三个自己写.
while(true)switch(System.in.read()){
case '\r':break;
case '\n':break;
case -1:break;
case 'A':System.out.println("A is used to add two numbers");break;
case 'S':System.out.println("S is used to subtract two numbers");break;
case 'M':System.out.println("M is used to multiply two numbers");break;
case 'D':System.out.println("D is used to divide two numbers");break;
default :System.out.println("Invalid Input");break;
}
2.
Scanner scn=new Scanner(System.in);
while(scn.hasNextInt())switch(scn.nextInt()){
case 0:System.out.println("ZERO");break;
case 1:System.out.println("ONE");break;
case 2:System.out.println("TWO");break;
case 3:System.out.println("THREE");break;
case 4:System.out.println("FOUR");break;
case 5:System.out.println("FIVE");break;
case 6:System.out.println("SIX");break;
case 7:System.out.println("SEVEN");break;
case 8:System.out.println("EIGHT");break;
case 9:System.out.println("NINE");break;
default :System.out.println("Invalid Input");break;
}
3.第三个自己写.
找高手做JAVA 里SWITCH 编程(题是英文的)
Java 英文编程题【急】
JAVA 中SWITCH 括号里跟什么类型的
一道英文的Java编程题目
希望有高手大大帮我做一道SAS统计学编程的题,英文的
java里 编程计算1至50中是7的倍数的数值之和
求会英文的java大神帮忙解决一道编程题
英语翻译这是一个java编程题,题目是英文的,想要翻译,如果能完成程序编写,追加100分Pi can be calcul
JAVA 关于class 的编程!
Java 编程找出所有的水仙花数(水仙花数).
JAVA高手来帮帮忙啦,两道编程题。悬赏30分。在线等!!!
Java 编程题,定义一个时钟类(Clock)