找高手做JAVA 里SWITCH 编程(题是英文的)Exercise on Switch StatementFor 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 examp

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/13 07:04:15

找高手做JAVA 里SWITCH 编程(题是英文的)Exercise on Switch StatementFor 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 examp
找高手做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.

找高手做JAVA 里SWITCH 编程(题是英文的)Exercise on Switch StatementFor 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 examp
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.第三个自己写.