1 StartSMS.javapackage cn.itcast;import ;/*** 系统开启类** @author Administrator**/public class StartSMS {public StartSMS() {}public static void main(String args[]) {Data data = new Data();data.ini();Menu menu = new Menu();menu.setData(data.goodsName, data.goodsPrice, data.custNo,data.custBirth, data.custScore);menu.showLoginMenu();boolean flag = true;label0: do {if (!flag)break;Scanner scanner = new Scanner(System.in);int i = scanner.nextInt();VerifyEqual verifyequal = new VerifyEqual();switch (i) {case 1: // '\001'int j = 3;do {if (j < 1)continue label0;if (verifyequal.verify(,{menu.showMainMenu();continue label0;}if (j != 1) {"\n用户名和密码不匹配,请重新输入:");} else {"\n您没有权限进入系统!谢谢!");flag = false;}j--;} while (true);case 2: // '\002'if (verifyequal.verify(,{"请输入新的用户名:");= scanner.next();"请输入新的密码:");= scanner.next();"用户名和密码已更改!");"\n请选择,输入数字:");} else {"抱歉,你没有权限修改!");flag = false;}break;case 3: // '\003'"谢谢您的使用!");//flag = false;System.exit(0);break;default:"\n输入有误!请重新选择,输入数字: ");break;}} while (flag);}}2 VerifyEqual.javapackage cn.itcast;import ;/*** 验证管理员登录** @author Administrator**/public class VerifyEqual {public VerifyEqual() {}public boolean verify(String s, String s1) {"请输入用户名:");Scanner scanner = new Scanner(System.in);String s2 = scanner.next();scanner = new Scanner(System.in);String s3 = scanner.next();return s2.equals(s) && s1.equals(s3);}}3 CustManagement.javapackage cn.itcast;import ;public class CustManagement {public CustManagement() {}public void setData(String as[], double ad[], int ai[], String as1[],int ai1[]) {goodsName = as;goodsPrice = ad;custNo = ai;custBirth = as1;custScore = ai1;}public void returnLastMenu() {"\n\n请按'n'返回上一级菜单:");Scanner scanner = new Scanner(System.in);boolean flag = true;doif (scanner.next().equals("n")) {Menu menu = new Menu();menu.setData(goodsName, goodsPrice, custNo, custBirth,custScore);menu.showCustMMenu();} else {"输入错误, 请重新'n'返回上一级菜单:");flag = false;}while (!flag);}public void add() {"购物管理系统 > 客户信息管理 > 添加客户信息\n\n");Scanner scanner = new Scanner(System.in);"请输入会员号(<4位整数>):");int i = scanner.nextInt();"请输入会员生日(月/日<用两位数表示>):");String s = scanner.next();int j = scanner.nextInt();int k = -1;int l = 0;do {if (l >= custNo.length)break;if (custNo[l] == 0) {k = l;break;}l++;} while (true);custNo[k] = i;custBirth[k] = s;custScore[k] = j;"新会员添加成功!");returnLastMenu();}public void modify() {"购物管理系统 > 客户信息管理 > 修改客户信息\n\n");"请输入会员号:");Scanner scanner = new Scanner(System.in);int i = scanner.nextInt();" 会员号生日积分 ");"------------|------------|---------------");int j = -1;int k = 0;do {if (k >= custNo.length)break;if (custNo[k] == i) {StringBuilder()).append(custNo[k]) .append("\t\t").append(custBirth[k]).append("\t\t").append(custScore[k]).toString());j = k;break;}k++;} while (true);if (j != -1) {System.out.println("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");"\t\t\t\t1.修改会员生日.\n");"\t\t\t\t2.修改会员积分.\n");System.out.println("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");"请选择,输入数字:");switch (scanner.nextInt()) {case 1: // '\001'"请输入修改后的生日:");custBirth[j] = scanner.next();"生日信息已更改!");break;case 2: // '\002'"请输入修改后的会员积分:");custScore[j] = scanner.nextInt();"会员积分已更改!");break;}} else {"抱歉,没有你查询的会员。
");}returnLastMenu();}public void search() {"购物管理系统 > 客户信息管理 > 查询客户信息\n");String s = "y";Scanner scanner = new Scanner(System.in);for (; s.equals("y"); s = scanner.next()) {"请输入会员号:");int i = scanner.nextInt();" 会员号生日积分");"------------|------------|---------------");boolean flag = false;int j = 0;do {if (j >= custNo.length)break;if (custNo[j] == i) {StringBuilder()).append(custNo[j]) .append("\t\t").append(custBirth[j]).append("\t\t").append(custScore[j]).toString());flag = true;break;}j++;} while (true);if (!flag)"抱歉,没有你查询的会员信息。
");"\n要继续查询吗(y/n):");}returnLastMenu();}public void show() {"购物管理系统 > 客户信息管理 > 显示客户信息\n\n");" 会员号生日积分 ");"------------|------------|---------------");int i = custNo.length;for (int j = 0; j < i && custNo[j] != 0; j++)StringBuilder()).append(custNo[j]).append( "\t\t").append(custBirth[j]).append("\t\t").append(custScore[j]).toString());returnLastMenu();}public String goodsName[];public double goodsPrice[];public int custNo[];public String custBirth[];public int custScore[];}4 Date.javapackage cn.itcast;/*** 初始化数据** @author Administrator**/public class Data {public Data() {goodsName = new String[50];goodsPrice = new double[50];custNo = new int[100];custBirth = new String[100];custScore = new int[100];manager = new Manager();}public void ini() {goodsName[0] = "addidas运动鞋";goodsPrice[0] = 880D;goodsName[1] = "Kappa网球裙";goodsPrice[1] = 200D;goodsName[2] = "网球拍";goodsPrice[2] = 780D;goodsName[3] = "addidasT恤";goodsPrice[3] = 420.999997D;goodsName[4] = "Nike运动鞋";goodsPrice[4] = 900D;goodsName[5] = "Kappa网球";goodsPrice[5] = 45D;goodsName[6] = "KappaT恤";goodsPrice[6] = 245D;custNo[0] = 1900;custBirth[0] = "08/05";custScore[0] = 2000;custNo[1] = 1711;custBirth[1] = "07/13";custScore[1] = 4000;custNo[2] = 1623;custBirth[2] = "06/26";custScore[2] = 5000;custNo[3] = 1545;custBirth[3] = "04/08";custScore[3] = 2200;custNo[4] = 1464;custBirth[4] = "08/16";custScore[4] = 1000;custNo[5] = 1372;custBirth[5] = "12/23";custScore[5] = 3000;custNo[6] = 1286;custBirth[6] = "12/21";custScore[6] = 10080;}public String goodsName[];public double goodsPrice[];public int custNo[];public String custBirth[];public int custScore[];public Manager manager;}5 Gift.javapackage cn.itcast;/*** 礼物类*/public class Gift {public Gift() {}public String toString() {return (new StringBuilder()).append("一个价值¥").append(price).append("的").append(name).toString();}public String name;public double price;}6 GiftManagement.javapackage cn.itcast;import ;/*** 礼物管理类** @author Administrator**/public class GiftManagement {public GiftManagement() {}public void setData(String as[], double ad[], int ai[], String as1[],int ai1[]) {goodsName = as;goodsPrice = ad;custNo = ai;custBirth = as1;custScore = ai1;}public void returnLastMenu() {"\n\n请按'n'返回上一级菜单:");Scanner scanner = new Scanner(System.in);boolean flag = true;doif (scanner.next().equals("n")) {Menu menu = new Menu();menu.setData(goodsName, goodsPrice, custNo, custBirth,custScore);menu.showSendGMenu();} else {"输入错误, 请重新'n'返回上一级菜单:");flag = false;}while (!flag);}public void sendBirthCust() {"购物管理系统 > 生日问候\n\n");"请输入今天的日期(月/日<用两位表示>):");Scanner scanner = new Scanner(System.in);String s = scanner.next();;String s1 = "";boolean flag = false;for (int i = 0; i < custBirth.length; i++)if (custBirth[i] != null &&custBirth[i].equals(s)) {s1 = (newStringBuilder()).append(s1).append(custNo[i]).append("\n").toString();flag = true;}if (flag) {"过生日的会员是:");;"恭喜!获赠MP3一个!");} else {"今天没有过生日的会员!");}returnLastMenu();}public void sendLuckyCust() {"购物管理系统 > 幸运抽奖\n\n");"是否开始(y/n):");Scanner scanner = new Scanner(System.in);if (scanner.next().equals("y")) {int i = (int) (Math.random() * 10D);boolean flag = false;String s = "";for (int k = 0; k < custNo.length && custNo[k] != 0; k++) {int j = (custNo[k] / 100) % 10;if (j == i) {s = (newStringBuilder()).append(s).append(custNo[k]).append("\t").toString();flag = true;}}if (flag)StringBuilder()).append("幸运客户获赠MP3:").append(s).toString());else"无幸运客户。