Java
小游戏
第一个
Java
文件:
import
java.util.Scanner;
public
class
GameA_B{
public
static
void
main(String[]args){
Scannerreader=
new
Scanner(System.
in
);
int
area;
System.
out
.println(
"Game
Start…………Please
enter
the
area:(1
-9)"
+
'\n'
+
"1,2,3meanseasy"
+
'\n'
+
"4,5,6meansmiddle"
+
'\n'
+
"7,8,9meanshard"
+
'\n'
+
"Pleasechoose:"
);
a
rea=reader.nextInt();
s
witch
((area-1)/3)
{
c
ase
0:System.
out
.println(
"Youchooseeasy!"
);
break
;
c
ase
1:System.
out
.println(
"Youchoosemiddle!"
);
break
;
c
ase
2:System.
out
.println(
"Youchoosehard!"
);
break
;
}
S
ystem.
out
.println(
"GoodLuck!"
);
G
ameProcessgame1=
new
GameProcess(area);
game1.process();
}
}
第二个
Java
文件:
import
java.util.Random;
import
java.util.Scanner;