update,
This commit is contained in:
30
_resources/it114105/itp3914/Lab06/Ex5.java
Normal file
30
_resources/it114105/itp3914/Lab06/Ex5.java
Normal file
@@ -0,0 +1,30 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Ex5 {
|
||||
public static void main(String[] args) {
|
||||
Scanner scan = new Scanner(System.in);
|
||||
int a;
|
||||
int x = 0;
|
||||
|
||||
System.out.print("a: ");
|
||||
a = scan.nextInt();
|
||||
|
||||
switch (a) {
|
||||
case 1:
|
||||
x += 3;
|
||||
break;
|
||||
case 2:
|
||||
x += 3;
|
||||
break;
|
||||
case 3:
|
||||
x += 5;
|
||||
break;
|
||||
default:
|
||||
x += 7;
|
||||
break;
|
||||
}
|
||||
|
||||
System.out.println("x = " + x);
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user