package com.fnd.twoDayFour;
import java.util.Random;
import java.util.Scanner;
public class work2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
String[] inits={"1.注册","2.登录","3.抽奖"};
String str = null;
do {
System.out.println("*********欢迎进入奖课富翁系统*************");
for (String string : inits) {
System.out.println(" " + string);
}
System.out.println("************************************");
String name;
String pwd;
int id;
id =new Random().nextInt(9999);//生成4位会员卡号
System.out.print("请选择菜单:");
int num;
num = sc.nextInt();
switch (num) {
case 1:
System.out.println("[<奖课富翁系统>注册]");
System.out.println("请填写个人注册信息:");
System.out.print("用户名:");
name = sc.next();
System.out.print("密码:");
pwd = sc.next();
System.out.println("注册成功,请记好您的会员卡号");
System.out.println("用户名 " + "密码 " + "会员卡号");
System.out.println(name + " " + pwd + " " + id);
break;
case 2:
System.out.println("[<奖课富翁系统>登录]");
System.out.print("请输入用户名");
name = sc.next();
System.out.print("请输入密码");
pwd = sc.next();
if (name.equals("admin")&&pwd.equals("123456")) {
System.out.println("欢迎您"+name);
}
break;
case 3:
System.out.println("[<奖课富翁系统>抽奖]");
System.out.print("请输入您的卡号:"+id);
id = sc.nextInt();//输入之前生成的会员卡号
int id1 =new Random().nextInt(9999);
int id2 =new Random().nextInt(9999);
int id3 =new Random().nextInt(9999);
int id4 =new Random().nextInt(9999);
int id5 =new Random().nextInt(9999);
System.out.print("本日的幸运数字为:"+id1+" "+id2+" "+id3+" "+id4+" "+id5);
if(id1==id||id2==id||id3==id||id4==id||id5==id){
System.out.println("您是今日的幸运会员");
}else {
System.out.println("很抱歉,您不是今日的幸运会员");
}
break;
default:
System.out.println("您的输入有误");
}
System.out.print("继续吗?(y/n)");
str = sc.next();
} while (str.equals("y"));
if(str.equals("n")){
System.out.println("系统退出,谢谢使用!");
}
}
}