import java.util.Scanner;
public class NumManageMain {
public static void main(String[] args) {
NumManage lottery = new NumManage();
lottery.lottery();
}
}
import java.util.Scanner;
public class NumManage {
int userNum ;
int winNum = 98;
Scanner in = new Scanner(System.in);
public void lottery() {
System.out.println("-----------------------------------");
System.out.println(" 欢迎进入六合彩 ");
System.out.println("请您输入您的操作:1.开始选号 2.现在开奖 3. 退出");
System.out.println("------------------------------------------");
System.out.println("请您输入您的选择:");
int input = in.nextInt();
switch (input){
case 1:
number();
break;
case 2:
optiontwo();
break;
case 3:
System.out.println("欢迎下次光临!");
break;
default:
System.out.println("你输入的号码有误,请重新输入");
lottery();
break;
}
}
public void number(){
System.out.println("请您输入您的号码,号码不能超过两位数");
int next = in.nextInt();
if (next>=0 && next<99){
userNum=next;
System.out.println("输入完毕,请选择:");
lottery();
}else {
System.out.println("你输入的有误请重新输入");
optiontwo();
}
}
public void optiontwo(){
if (userNum ==0){
System.out.println("您还没有输入号码");
number();
}
if (userNum==winNum){
System.out.println("恭喜您中奖了,中了9999元");
}else {
goon();
}
}
public void goon(){
System.out.println("很遗憾您没有中奖,是否继续选号呢? y/n");
char letter = in.next().charAt(0);
if (letter == 'y'){
number();
}else if (letter== 'n'){
}else {
System.out.println("没有您输入的");
goon();
}
}
}