2019-07-24

package com.foreknow.test;

import java.util.Scanner;

import javax.imageio.stream.MemoryCacheImageInputStream;
import javax.swing.Spring;

public class lllx {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int id;
int sid;
String yonghuming = "";
String mima = null;
String s = "y";
String name;
String a;
// s=="y"
// "y".equals(s)
while ("y".equals(s)) {
System.out.println("欢迎进入讲课富翁系统");
System.out.println("1.注册");
System.out.println("2.登录");
System.out.println("3.抽奖");
System.out.println("-------------------------");
System.out.println("请选择菜单");
id = input.nextInt();

        switch (id) {
        case 1:
            System.out.println("注册");
            System.out.println("请填写个人信息");
            System.out.println("用户名:");
            yonghuming = input.next();
            System.out.println("密码:");
            mima = input.next();

            System.out.println("注册成功,请记好您的会员号");
            sid = (int) (Math.random() * ((9999 - 1000) + 1 * 1000));
            System.out.println("用户名" + yonghuming + "密码" + mima + "会员卡号" + sid);

            break;
        case 2:
            for(int i=0;i<3;i++)
            System.out.println("登录");
            System.out.println("请输入用户名");
            name = input.next();
            System.out.println("请输入密码");
            a = input.next();
            if (mima.equals(a) && (yonghuming.equals(name))) {
                System.out.println("登陆成功");
                break;
            } else {
                System.out.println("登录失败");

            }

        }

    }

}

}

你可能感兴趣的:(2019-07-24)