超市會員管理系統

好難啊!還要再改!java

————————————————————————————————————————————app

超市會員管理系統要求
·系統菜單分爲兩級
一級菜單:登陸、開卡、退出系統
二級菜單(登陸以後):積分累積、積分兌換、積分查詢、修改密碼、退出登陸dom

·開卡的帳號不能重複ui

·驗證用戶名
用戶名不能以數字開頭,不能有特殊符號,用戶名長度必須是3-6位之間
·驗證密碼
密碼長度必須是6-16位之間,不能有中文、空格,驗證密碼強度:
純數字、純英文是低,數字+英文是中,數字+英文+特殊字符是高
·開卡時須要輸入驗證碼,驗證碼不區分大小寫this

·輸入積分、消費金額時,必須是數字,若不是數字從新輸入spa

·修改密碼若是是舊密碼則提示修改失敗,若是是新密碼也要驗證密碼,而且修改爲功後須要退出從新登陸code

·登陸時,若是密碼連續輸入五次失敗,則凍結當前帳戶blog

·登陸時,有忘記密碼提示,因此要求要實現密保問題驗證,在忘記密碼時可以找回密碼get

————————————————————————————————————————————————————it

 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("一、登陸\n"+"二、開卡\n"+"三、退出系統"); 25         
26  } 27 }
相關文章
相關標籤/搜索