《java购物系统源代码(17页).doc》由会员分享,可在线阅读,更多相关《java购物系统源代码(17页).doc(17页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、-java购物系统源代码-第 17 页package cn.itcast;import java.util.Scanner; * 系统开启类 * author Administratorpublic 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);Sys
3、tem.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;custScorek = j;
4、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 = 0;do if (k = custNo.
5、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(* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n);S
6、ystem.out.println(tttt1.修 改 会 员 生 日.n);System.out.println(tttt2.修 改 会 员 积 分.n);System.out.println(* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n);System.out.print(请选择,输入数字:);switch (scanner.nextInt() case 1: / 001System.out.print(请输入修改后的生日:);custBirthj = scanner.nex
7、t();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(购物管理系统 客户信息管理 查询客户信息n);String s = y;Scanner scanner = n
8、ew 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 (custNoj = i) System.out.println(new StringBuilder().append(cust
9、Noj).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.out.println(购物管理系统 客户信息管理 显示客户信息nn);System.out.println( 会员号 生日 积分 );S
10、ystem.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 = false;for (int i = 0; i 幸运抽奖nn);System.out.print(是否开始(y/n):);Scanner scanner
11、= 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;i = k;System.out.println(new StringBuilder().append(具有最高积分的会员是: ).append(custNoi).app
12、end(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();public String goodsName;public double goodsPrice;public int custNo;public String custBirth;public int
13、 custScore;7package cn.itcast; * 管理员类 * author Administratorpublic class Manager public Manager() username = itcast;password = itcast;public String username;public String password;package cn.itcast;import java.util.Scanner; * 页面类 * author Administratorpublic class Menu public Menu() public void setD
14、ata(String as, double ad, int ai, String as1,int ai1) goodsName = as;goodsPrice = ad;custNo = ai;custBirth = as1;custScore = ai1;public void showLoginMenu() System.out.println(nnttt 欢迎使用itcast购物管理系统版nn);System.out.println(* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
15、*n);System.out.println(tttt 1. 登 录 系 统nn);System.out.println(tttt 2. 更 改 管 理 员 密 码nn);System.out.println(tttt 3. 退 出nn);System.out.println(* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n);System.out.print(请选择,输入数字:);public void showMainMenu() System.out.println(nnttt
16、t欢迎使用购物管理系统n);System.out.println(* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n);System.out.println(tttt 1. 客 户 信 息 管 理n);System.out.println(tttt 2. 购 物 结 算n);System.out.println(tttt 3. 真 情 回 馈n);System.out.println(tttt 4. 注 销n);System.out.println(* * * * * * * * *
17、* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n);System.out.print(请选择,输入数字:);Scanner scanner = new Scanner(System.in);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,
18、custBirth,custScore);pay.calcPrice();break;if (s.equals(3) showSendGMenu();break;if (s.equals(4) showLoginMenu();break;System.out.print(输入错误,请重新输入数字:);flag = false; while (!flag);public void showCustMMenu() System.out.println(购物管理系统 客户信息管理n);System.out.println(* * * * * * * * * * * * * * * * * * * *
19、 * * * * * * * * * * * * * * * * * * * *n);System.out.println(tttt 1. 显 示 所 有 客 户 信 息n);System.out.println(tttt 2. 添 加 客 户 信 息n);System.out.println(tttt 3. 修 改 客 户 信 息n);System.out.println(tttt 4. 查 询 客 户 信 息n);System.out.println(* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
20、* * * * *n);System.out.print(请选择,输入数字或按n返回上一级菜单:);Scanner scanner = new Scanner(System.in);boolean flag = true;do CustManagement custmanagement = new CustManagement();custmanagement.setData(goodsName, goodsPrice, custNo, custBirth,custScore);String s = scanner.next();if (s.equals(1) custmanagement.s
21、how();break;if (s.equals(2) custmanagement.add();break;if (s.equals(3) custmanagement.modify();break;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(购物管理系统
22、 真情回馈n);System.out.println(* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n);System.out.println(tttt 1. 幸 运 大 放 送n);System.out.println(tttt 2. 幸 运 抽 奖n);System.out.println(tttt 3. 生 日 问 候n);System.out.println(* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
23、 * * * * * * * * * *n);System.out.print(请选择,输入数字或按n返回上一级菜单:);Scanner scanner = 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.sendLuckyCust();break;