JAVA中幸运抽奖

import java.util.Scanner;
/**
醉翁
2017/11/02
/*/

public class XinYun {
			int menu;
			String name ="";
			int password;
			int panPassord;
			String panDuanName = "";
			String JiXu = "";
			int cardNumber;
	Scanner input = new Scanner(System.in);
	
	//开始方法类
	public void State(){
		System.out.println("*******欢迎进入幸运抽奖系统*******");
		System.out.println("\t1.注册");
		System.out.println("\t2.登录");
		System.out.println("\t3.抽奖");
		System.out.println("**********************************");
		System.out.print("你选择菜单: ");
		menu = input.nextInt();
		switch(menu){
		case 1:
			ZhuCe();
			break;
		case 2:
			Login();
			break;
		case 3:
			ChouJiang();
			break;
		default :
			System.out.println("系统退出,谢谢使用!");
		}
		
	}	
	   //注册方法类:
	public void ZhuCe(){
		
		System.out.println("[奖客富翁系统>注册]");
		System.out.println("请填写个人注册信息:");
		System.out.print("用户名:");
		name = input.next();
		System.out.print("密码: ");
		password = input.nextInt();
		
		//注册成功的情况
		//随机四位是数;
		int max = 9999;
		int min = 1000;
		cardNumber = (int)(Math.random()*(max-min)+min);
		System.out.println("\n注册成功,请记好你的卡号!");
		System.out.println("用户名\t密码\t会员卡号");
		System.out.println(name+"\t"+password+"\t"+cardNumber);
		System.out.print("是否继续(y/n)\n");
		JiXu = input.next();
		if(JiXu.equals("y")){
			State();
		}else{
			System.out.println("系统退出,谢谢使用!");
		}
		
	}
	
	//登录类:
	public void Login(){
		System.out.println("奖客富翁系统>登录]");
		
		int cishu =0;
		for(int i = 1;i<=3;i++){
			if (panDuanName==name&&panPassord==password){
				System.out.println("您登陆成功!");
				cishu++;   //循环,输入次数够四次时
				if(cishu==3){
					System.out.println("你没有机会了!");
					break;
					}
				}
			}
		
		System.out.println("\n欢迎您: "+name);
			
			System.out.print("是否继续(y/n)\n");
			JiXu = input.next();
			if(JiXu.equals("y")){
				State();
			}else{
				System.out.println("系统退出,谢谢使用!");
			}	
	}
	//抽奖类的方法:
			public void ChouJiang(){
				System.out.println("奖客富翁系统>抽奖");
				System.out.print("你输入您的卡号:");
				int card = input.nextInt();
				int[] num = new int[]{9402,5668,8042,8512,5444,4213};
				System.out.print("\n本日的幸运数字为:");
				int j;   //遍历输出数组num的元素
				for(j =0;j

你可能感兴趣的:(Java)