Escolar Documentos
Profissional Documentos
Cultura Documentos
switch
main
break
switch
break
case 1:
switch
choice
both
(op1 + op2)
case 1:
op1 + op2
String
int
char
integers
characters short
byte
10-3
System.out.println(Make your arithmetic selection from the choices below:\n);
System.out.println(
System.out.println(
System.out.println(
System.out.println(
A.
S.
M.
D.
System.out.print(
Addition);
Subtraction);
Multiplication);
Division\n);
Your choice? );
10-4
break;
case Hello:
System.out.println(You said Hello.);
break;
case Auf wiedersehen:
System.out.println(You spoke German.);
break;
default:
System.out.println(What did you say?);
}
ProjectCalculator
Produce a new calculator program by modifying the code on page 10-3 to switch on the
Strings Add, Subtract, Multiply, and Divide rather than characters.