zoukankan      html  css  js  c++  java
  • 超市会员管理系统

    好难啊!还要再改!

    ————————————————————————————————————————————

    超市会员管理系统要求
    ·系统菜单分为两级
    一级菜单:登录、开卡、退出系统
    二级菜单(登录之后):积分累积、积分兑换、积分查询、修改密码、退出登录

    ·开卡的账号不能重复

    ·验证用户名
    用户名不能以数字开头,不能有特殊符号,用户名长度必须是3-6位之间
    ·验证密码
    密码长度必须是6-16位之间,不能有中文、空格,验证密码强度:
    纯数字、纯英文是低,数字+英文是中,数字+英文+特殊字符是高
    ·开卡时需要输入验证码,验证码不区分大小写

    ·输入积分、消费金额时,必须是数字,若不是数字重新输入

    ·修改密码如果是旧密码则提示修改失败,如果是新密码也要验证密码,并且修改成功后需要退出重新登录

    ·登录时,如果密码连续输入五次失败,则冻结当前账户

    ·登录时,有忘记密码提示,所以要求要实现密保问题验证,在忘记密码时能够找回密码

    ————————————————————————————————————————————————————

     1 package market;
     2 /**
     3  * 用户类
     4  * @author L
     5  *
     6  */
     7 public class User {
     8     private String id;
     9     private String account;
    10     private String password;
    11     private String phone;
    12     private int code;//积分
    13     private String problem;//密保问题
    14     private String answer;//密保答案
    15     
    16     public User() {
    17         // TODO Auto-generated constructor stub
    18     }
    19 
    20     public User(String id, String account, String password, String phone, int code, String problem, String answer) {
    21         super();
    22         this.id = id;
    23         this.account = account;
    24         this.password = password;
    25         this.phone = phone;
    26         this.code = code;
    27         this.problem = problem;
    28         this.answer = answer;
    29     }
    30 
    31     public String getId() {
    32         return id;
    33     }
    34 
    35     public void setId(String id) {
    36         this.id = id;
    37     } 
    38 
    39     public String getAccount() {
    40         return account;
    41     }
    42 
    43     public void setAccount(String account) {
    44         this.account = account;
    45     }
    46 
    47     public String getPassword() {
    48         return password;
    49     }
    50 
    51     public void setPassword(String password) {
    52         this.password = password;
    53     }
    54 
    55     public String getPhone() {
    56         return phone;
    57     }
    58 
    59     public void setPhone(String phone) {
    60         this.phone = phone;
    61     }
    62 
    63     public int getCode() {
    64         return code;
    65     }
    66 
    67     public void setCode(int code) {
    68         this.code = code;
    69     }
    70 
    71     public String getProblem() {
    72         return problem;
    73     }
    74 
    75     public void setProblem(String problem) {
    76         this.problem = problem;
    77     }
    78 
    79     public String getAnswer() {
    80         return answer;
    81     }
    82 
    83     public void setAnswer(String answer) {
    84         this.answer = answer;
    85     }
    86     
    87     
    88 }
     1 package market;
     2 import java.util.Random;
     3 /**
     4  * 注册类
     5  */
     6 import java.util.Scanner;
     7 
     8 public class Register {
     9     static Scanner sc=new Scanner(System.in);
    10     
    11     public static void register() {
    12         System.out.println("正在加载开卡系统……");
    13         System.out.println("***欢迎进入注册系统***");
    14         System.out.println("请输入用户名:");
    15         String account=sc.next();
    16         System.out.println("请输入密码:");
    17         String password=sc.next();
    18         while(getCode()) {
    19             System.out.println("验证码输入有误!");
    20         }
    21         String id=getId();
    22         System.out.println("根据密码问题,找回密码");
    23         System.out.println();
    24         
    25     }
    26     
    27     //验证码
    28     public static boolean getCode() {
    29         String code=null;
    30         String str="0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASFGHJKLZXCVBNM";
    31         String[]strs=str.split("");
    32         for(int i=0;i<6;i++) {
    33             code+=strs[(int)(Math.random()*strs.length)];
    34         }
    35         System.out.println("请输入验证码:"+code);
    36         String enterCode=sc.next();
    37         if(enterCode.equals(code)) {
    38             return false;
    39         }
    40         return true;
    41     }
    42     
    43     //随机卡号
    44     public static String getId() {
    45         Random random=new Random();
    46         StringBuffer sbf=null;
    47         while(true) {
    48             sbf=new StringBuffer();
    49             for(int i=0;i<8;i++) {
    50                 int num=random.nextInt(8);
    51                 sbf.append(num);
    52             }
    53             if(MarketSystem.map.get(sbf)++null) {
    54                 
    55             }
    56         }
    57         
    58     }
    59 }
     1 package market;
     2 
     3 import java.util.HashMap;
     4 import java.util.Map;
     5 import java.util.Scanner;
     6 
     7 public class MarketSystem {
     8     static Scanner sc=new Scanner(System.in);
     9     
    10     static Map<String, User>map=new HashMap<String, User>();
    11     static final int nums=5;//密码错误上限
    12     static {
    13         map.put("admin01", new User("12940328", "admin01", "12345600", "13800000000", 4, "昨天吃了啥?", "红烧肉"));
    14         map.put("admin02", new User("37483903", "admin02", "12345600", "13800000000", 5, "昨天吃了啥?", "糖醋排骨"));
    15         map.put("admin03", new User("12436898", "admin03", "12345600", "13800000000", 2, "昨天吃了啥?", "红烧鱼"));
    16     }
    17     
    18     public static void main(String[] args) {
    19         
    20     }
    21     
    22     public static void Menu() {
    23         System.out.println("***欢迎进入暴富超级大商场会员管理系统***");
    24         System.out.println("1、登录
    "+"2、开卡
    "+"3、退出系统");
    25         
    26     }
    27 }
  • 相关阅读:
    HTML(图像img、表格table、列表)
    HTML(标题h、段落p、文本格式化、链接a、头部head)
    List的复制 (浅拷贝与深拷贝)
    最新CentOS6.5安装Docker, 使用阿里云源下载(亲测)
    VirtualBox安装CentOS6.5
    P1010 幂次方 题解
    P1469 找筷子 题解
    P1866 编号 题解
    EasyNVR通道离线但视频流可正常播放是什么原因导致的?
    EasyNVR通过国标GB28181协议级联出现报错及播放不了的问题调整
  • 原文地址:https://www.cnblogs.com/yanglanlan/p/11300646.html
Copyright © 2011-2022 走看看