1、1 StartSMS.javapackage cn.itcast;import java.util.Scanner;/* 系统开启类* * 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
2、, 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: / 001int j = 3;do if (j 客户信息管理 添加客户信息nn“);Scanner scanner = new Scanner(System.in);S
3、ystem.out.print(“请输入会员号():“);int i = scanner.nextInt();System.out.print(“请输入会员生日(月/日 ):“);String s = scanner.next();System.out.print(“请输入积分:“);int j = scanner.nextInt();int k = -1;int l = 0;do if (l = custNo.length)break;if (custNol = 0) k = l;break;l+; while (true);custNok = i;custBirthk = s;custSc
4、orek = j;System.out.println(“新会员添加成功! “);returnLastMenu();public void modify() System.out.println(“购物管理系统 客户信息管理 修改客户信息nn“);System.out.print(“请输入会员号:“);Scanner scanner = new Scanner(System.in);int i = scanner.nextInt();System.out.println(“ 会员号 生日 积分 “);System.out.println(“-|-|-“);int j = -1;int k =
5、0;do if (k = custNo.length)break;if (custNok = i) System.out.println(new StringBuilder().append(custNok).append(“tt“).append(custBirthk).append(“tt“).append(custScorek).toString();j = k;break;k+; while (true);if (j != -1) System.out.println(“* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
6、* * * * * * * * * * *n“);System.out.println(“tttt1.修 改 会 员 生 日.n“);System.out.println(“tttt2.修 改 会 员 积 分.n“);System.out.println(“* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n“);System.out.print(“请选择,输入数字:“);switch (scanner.nextInt() case 1: / 001System.out.print(“请
7、输入修改后的生日:“);custBirthj = scanner.next();System.out.println(“生日信息已更改!“);break;case 2: / 002System.out.print(“请输入修改后的会员积分:“);custScorej = scanner.nextInt();System.out.println(“会员积分已更改!“);break; else System.out.println(“抱歉,没有你查询的会员。 “);returnLastMenu();public void search() System.out.println(“购物管理系统 客户
8、信息管理 查询客户信息n“);String s = “y“;Scanner scanner = new Scanner(System.in);for (; s.equals(“y“); s = scanner.next() System.out.print(“请输入会员号:“);int i = scanner.nextInt();System.out.println(“ 会员号 生日 积分 “);System.out.println(“-|-|-“);boolean flag = false;int j = 0;do if (j = custNo.length)break;if (custNo
9、j = i) System.out.println(new StringBuilder().append(custNoj).append(“tt“).append(custBirthj).append(“tt“).append(custScorej).toString();flag = true;break;j+; while (true);if (!flag)System.out.println(“抱歉,没有你查询的会员信息。“);System.out.print(“n要继续查询吗( y/n):“ );returnLastMenu();public void show() System.ou
10、t.println(“购物管理系统 客户信息管理 显示客户信息nn“);System.out.println(“ 会员号 生日 积分 “);System.out.println(“-|-|-“);int i = custNo.length;for (int j = 0; j 生日问候nn“);System.out.print(“请输入今天的日期(月/日) :“);Scanner scanner = new Scanner(System.in);String s = scanner.next();System.out.println(s);String s1 = “;boolean flag =
11、 false;for (int i = 0; i 幸运抽奖nn“);System.out.print(“是否开始(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 幸运大放送nn“);int i = 0;int j = custScore0;for (int k = 0; k j) j = custScorek;
12、i = k;System.out.println(new StringBuilder().append(“具有最高积分的会员是: “).append(custNoi).append(“t“).append(custBirthi).append(“t“).append(custScorei).toString();Gift gift = new Gift();gift.name = “苹果笔记本电脑“ ;gift.price = 12000D;System.out.print(“恭喜!获赠礼品: “);System.out.println(gift);returnLastMenu();publi
13、c String goodsName;public double goodsPrice;public int custNo;public String custBirth;public int custScore;7 Manager.javapackage cn.itcast;/* 管理员类* * author Administrator* */public class Manager public Manager() username = “itcast“;password = “itcast“;public String username;public String password;8
14、Menu.javapackage cn.itcast;import java.util.Scanner;/* 页面类* * author Administrator* */public class Menu public Menu() 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 showLoginMenu() System.ou
15、t.println(“nnttt 欢迎使用itcast购物管理系统1.0版nn“);System.out.println(“* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n“);System.out.println(“tttt 1. 登 录 系 统nn“ );System.out.println(“tttt 2. 更 改 管 理 员 密 码nn“);System.out.println(“tttt 3. 退 出nn“);System.out.println(“* * * * * *
16、* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n“);System.out.print(“请选择, 输入数字:“);public void showMainMenu() System.out.println(“nntttt欢迎使用购物管理系统n“);System.out.println(“* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n“);System.out.println(“tttt 1.
17、客 户 信 息 管 理n“);System.out.println(“tttt 2. 购 物 结 算n“);System.out.println(“tttt 3. 真 情 回 馈n“);System.out.println(“tttt 4. 注 销n“);System.out.println(“* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n“);System.out.print(“请选择, 输入数字:“);Scanner scanner = new Scanner(System.i
18、n);boolean flag = false;do String s = scanner.next();if (s.equals(“1“) showCustMMenu();break;if (s.equals(“2“) Pay pay = new Pay();pay.setData(goodsName, goodsPrice, custNo, custBirth,custScore);pay.calcPrice();break;if (s.equals(“3“) showSendGMenu();break;if (s.equals(“4“) showLoginMenu();break;Sys
19、tem.out.print(“输入错误,请重新输入数字:“);flag = false; while (!flag);public void showCustMMenu() System.out.println(“购物管理系统 客户信息管理n“);System.out.println(“* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n“);System.out.println(“tttt 1. 显 示 所 有 客 户 信 息n“);System.out.println(“tttt 2
20、. 添 加 客 户 信 息n“);System.out.println(“tttt 3. 修 改 客 户 信 息n“);System.out.println(“tttt 4. 查 询 客 户 信 息n“);System.out.println(“* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n“);System.out.print(“请选择, 输入数字或按n返回上一级菜单:“);Scanner scanner = new Scanner(System.in);boolean flag
21、 = true;do CustManagement custmanagement = new CustManagement();custmanagement.setData(goodsName, goodsPrice, custNo, custBirth,custScore);String s = scanner.next();if (s.equals(“1“) custmanagement.show();break;if (s.equals(“2“) custmanagement.add();break;if (s.equals(“3“) custmanagement.modify();br
22、eak;if (s.equals(“4“) custmanagement.search();break;if (s.equals(“n“) showMainMenu();break;System.out.println(“输入错误 , 请重新输入数字:“);flag = false; while (!flag);public void showSendGMenu() System.out.println(“购物管理系统 真情回馈n“);System.out.println(“* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
23、* * * * * * * * * *n“);System.out.println(“tttt 1. 幸 运 大 放 送n“);System.out.println(“tttt 2. 幸 运 抽 奖n“);System.out.println(“tttt 3. 生 日 问 候n“);System.out.println(“* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n“);System.out.print(“请选择, 输入数字或按n返回上一级菜单:“);Scanner scanne
24、r = new Scanner(System.in);boolean flag = true;GiftManagement giftmanagement = new GiftManagement();giftmanagement.setData(goodsName, goodsPrice, custNo, custBirth,custScore);do String s = scanner.next();if (s.equals(“1“) giftmanagement.sendGoldenCust();break;if (s.equals(“2“) giftmanagement.sendLuc
25、kyCust();break;if (s.equals(“3“) giftmanagement.sendBirthCust();break;if (s.equals(“n“) showMainMenu();break;System.out.println(“输入错误 , 请重新输入数字:“);flag = false; while (!flag);public String goodsName;public double goodsPrice;public int custNo;public String custBirth;public int custScore;9 Pay.javapac
26、kage cn.itcast;import java.util.Scanner;/* 购物付款* * author Administrator* */public class Pay public Pay() public void setData(String as, double ad, int ai, String as1,int ai1) goodsName = as;goodsPrice = ad;custNo = ai;custBirth = as1;custScore = ai1;public double getDiscount(int i, int ai, int ai1)
27、int j = -1;int k = 0;do if (k = ai.length)break;if (i = aik) j = k;break;k+; while (true);double d;if (ai1j 购物结算nn“);System.out.println(“*“);System.out.println(“请选择购买的商品编号: “);int l = 0;double d4 = 0;for (; l = custNo.length)break;if (custNoj1 = i) custScorej1 = custScorej1 + i1;System.out.println(n
28、ew StringBuilder().append(“本次购物所获的积分是: “).append(i1).toString();break;j1+; while (true);System.out.print(“n请n返回上一级菜单:“ );if (scanner.next().equals(“n“) Menu menu = new Menu();menu.setData(goodsName, goodsPrice, custNo, custBirth, custScore);menu.showMainMenu();public String goodsName;public double goodsPrice;public int custNo;public String custBirth;public int custScore;