标签:
import java.util.Scanner;//主类 全局变量 用户 密码 会员号
public class CustomerExperience {
static String user;
static int passWord;
static int shipNum;
public static void main(String[] args) {
mainMenu.main(args);
}
}
import java.util.Scanner;//菜单类
public class mainMenu {
public static void main(String[] args) {
Shopping.xinhao(25);
System.out.print("欢迎进入奖客富翁系统");
Shopping.xinhao(25);
System.out.print("\r");
Shopping.tab(54);
System.out.print("1.注册");
System.out.print("\r");
Shopping.tab(54);
System.out.print("2.登入");
System.out.print("\r");
Shopping.tab(54);
System.out.print("3.抽奖");
System.out.print("\r");
Shopping.xinhao(50);
System.out.print("\r");
for(;;){
System.out.print("请选择菜单:");
Scanner input=new Scanner(System.in);
int menuNum=input.nextInt();
switch(menuNum){
case 1:
Login();
break;
case 2:
Enter();
case 3:
Lottery();
break;
default:
System.out.print("输入错误请重新");
continue;
}
}
}
public static void Login() { //账户注册
System.out.println("[奖客富翁系统>注册]");
System.out.println("请填写个人注册信息:");
System.out.print("用户名:");
Scanner input=new Scanner(System.in);
CustomerExperience.user=input.nextLine();
System.out.print("\n");
System.out.print("密码:");
Scanner input1=new Scanner(System.in);
CustomerExperience.passWord=input1.nextInt();
CustomerExperience.shipNum=(int) (Math.random()*8999+1000);
System.out.println("\r");
System.out.println("注册成功,请记好您的会员卡号");
System.out.println("用户名 密码 卡号 ");
System.out.println(CustomerExperience.user+" "+CustomerExperience.passWord+" "+CustomerExperience.shipNum);
System.out.print("继续吗?(y/n):");
Scanner input2=new Scanner(System.in);
String ifN=input2.nextLine();
System.out.print("\r");
if(ifN.equals("n")){
System.out.println("系统退出,谢谢使用!");
}
else{
main(null);
}
}
public static void Enter() { //账户登入函数
for(int i=3;i>=0;i--){
System.out.println("[奖客富翁系统>登入]");
System.out.print("请输入用户名:");
Scanner input=new Scanner(System.in);
String userS=input.nextLine();
System.out.print("\n");
System.out.print("请输入密码:");
Scanner input1=new Scanner(System.in);
int passWordS=input1.nextInt();
if(userS.equals(CustomerExperience.user)&&passWordS==CustomerExperience.passWord){
System.out.print("欢迎您:");
System.out.println(CustomerExperience.user);
System.out.print("继续吗?(y/n):");
Scanner input2=new Scanner(System.in);
String ifN=input2.nextLine();
System.out.print("\r");
if(ifN.equals("n")){
System.out.println("系统退出,谢谢使用!");
}
else{
main(null);
}
}
else{
System.out.println("账户信息错误,你还有"+i+"机会!");
continue;
}
}
}
public static void Lottery() { //会员抽奖
System.out.println("[奖客富翁系统>抽奖]");
System.out.print("请输入卡号:");
Scanner input=new Scanner(System.in);
int shipNumS=input.nextInt();
System.out.print("\r");
System.out.print("本日的幸运数字为:");
int[] luckNum=new int[4];
for(int i=0;i<4;i++){
luckNum[i]=(int) (Math.random()*8999+1000);
System.out.print(luckNum[i]+" ");
}
System.out.print("\r");
int n=0;
for(int i=0;i<4;i++){
if(luckNum[i]!=shipNumS){
n++;
continue;
}
else{
System.out.println("恭喜!您是本日的幸运会员!");
}
}
if(n==4){
System.out.println("抱歉!您不是是本日的幸运会员!");
}
System.out.print("继续吗?(y/n):");
Scanner input2=new Scanner(System.in);
String ifN=input2.nextLine();
System.out.print("\r");
if(ifN.equals("n")){
System.out.println("系统退出,谢谢使用!");
}
else{
main(null);
}
}
}
标签:
原文地址:http://www.cnblogs.com/Kongshanyu/p/5495912.html