1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
  import  java.util.Scanner;
 
public  class  A01 {
  /**
   * @param args
   */
  public  static  void  main(String[] args) {
   // TODO Auto-generated method stub
   
   String admin =  null ,password =  null ,admin2,password2,choice2 =  null ;
   int  random = ( int )(Math.random()* 4000 );
   do {
    Scanner input =  new  Scanner (System.in);
    System.out.println( "*******欢迎使用购物系统********" );
    System.out.println( "\t\t1.注册" );
    System.out.println( "\t\t2.登陆" );
    System.out.println( "\t\t1.抽奖" );
    System.out.println( "*****************************" );
    System.out.println( "请选择菜单:" );
    int  choice = input.nextInt();
   switch  (choice) {
   case  1 :
    System.out.println( "购物管理系统>注册" );
    System.out.println( "请输入用户名:" );
    admin = input.next();
    System.out.println( "请输入密码:" );
    password = input.next();
    System.out.println( "注册成功,请记好您的会员卡号" );
    System.out.println( "用户名\t密码\t会员卡号" );
    System.out.println(admin+ "\t" +password+ "\t" +random);
    break ;
   case  2 :
    System.out.println( "购物管理系统>登陆" );
    System.out.println( "请输入用户名:" );
    admin2=input.next();
    System.out.println( "请输入密码:" );
    password2=input.next();
    if  (admin.equals(admin2)&&password.equals(password2)){
     System.out.println( "欢迎您" +admin);
    } else {
     System.out.println( "用户名或密码错误!" );
    }
   }
   System.out.println( "是否继续(y / n):" );
   choice2=input.next();
   } while (choice2.equals( "y" ));
   System.out.println( "\n\n程序结束!" );
  }
}