/** @author:杨晓东* @date:2014-04-06* 我行我素购物系统*/import java.util.Scanner;// 导入一个外部的java类public class MyShop {public static void main(String [] args){/*需求:用户输入登录,如果登录失败,继续重新登录,失败次数超过三次,退出系统*/int loginIndex = 0;// 定义一个变量,存放用户登录失败的次数//第一个板块picture1:while(true) {// 展示登录菜单System.out.println("\t\t欢迎光临我行我素购物管理系统1.0版");System.out.println("                                                                 ");System.out.println("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");System.out.println("                                                                 ");System.out.println("\t\t\t1. 登 录 系 统");System.out.println("                                                                 ");System.out.println("\t\t\t2.更 改 用 户 密 码");System.out.println("                                                                 ");System.out.println("\t\t\t3. 退 出");System.out.println("                                                                 ");System.out.println("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");System.out.println("                                                                 ");// 提示用户输入选项System.out.print("请输入您的选项:");Scanner  input = new Scanner(System.in);int choice1 = input.nextInt();// 判断用户输入选项是否正确if(choice1 == 1) {/*登录系统*/// 登录系统要实现的功能:提示用户输入用户名和密码System.out.print("请输入用户名:");String username = input.next();System.out.print("请输入密码:");String password = input.next();// 判断用户输入的用户名是否admin,密码是否1111/* 整数判断可以用==;字符串是否相等判断,用equals方法*/if("yangxiaodong".equals(username) && "qwer".equals(password)){// 登录成功之后,系统后续要做的工作System.out.println("登录成功...");} else {//输入次数的判断loginIndex ++;if(loginIndex > 2) {System.out.println("您的输入已经超过上限,请重新登录");System.exit(1);//系统退出}System.out.println("您的用户名或者密码有误,请重新登录");continue;}break;//上面第一个if的括号  if(choice1 == 1)}else if(choice1 == 2) {/*更改管理员密码,提示系统升级...*/System.out.println("系统正在升级中...");System.out.println("请重新登录");continue;}else if (choice1 ==3){/*退出系统*/System.out.println("系统即将推出...");System.exit(1);//系统推出}else {/*没有这个选项*/System.out.println("对不起,没有该选项");System.out.print("请重新输入您的选择:");  choice1 = input.nextInt();continue;}break;}//第一个while的括号//第二个板块picture2:while (true){//第二个循环System.out.println("\t\t\t欢迎使用我行我素购物管理系统");System.out.println("                                                                 ");System.out.println("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");System.out.println("                                                                 ");System.out.println("\t\t\t1. 客 户 信 息 管 理");System.out.println("                                                                 ");System.out.println("\t\t\t2. 购 物 结 算");System.out.println("                                                                 ");System.out.println("\t\t\t3. 真 情 回 馈");System.out.println("                                                                 ");System.out.println("\t\t\t4. 返 回 上 一 级");System.out.println("                                                                 ");System.out.println("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");System.out.println("                                                                 ");System.out.print("请输入您的选择:");Scanner input = new Scanner(System.in);int choice2 = input.nextInt();//用while循环来说明没有的选项while (choice2 != 1 && choice2 != 2 && choice2 != 3 && choice2 != 4){System.out.println("没有这个选项,请重新输入");/*System.out.print("请重新输入您的选择:");choice2 = input.nextInt();//这里重新定义一个新的变量就会重复出现一次上一个界面*///退出此循环if(choice2 == 1 || choice2 == 2 || choice2 == 3 || choice2 == 4){  break;                }  }//在外部定义所有客户信息String username1 ="小猫";  String username2 ="小狗";  String username3 ="小马";  String username4 ="小狐狸";  String username5 ="大象";  String birthday1 ="1992-7-10";  String birthday2 ="1992-6-17";  String birthday3 ="1992-7-10";  String birthday4 ="1992-11-1";  String birthday5 ="1992-11-17"; //第二个界面的选择if (choice2 == 1){//choice2 == 1时显示System.out.println("我行我素购物管理系统>客户信息管理");System.out.println("                                                                 ");System.out.println("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");System.out.println("                                                                 ");System.out.println("\t\t\t1. 显 示 所 有 客 户 信 息");//可以有System.out.println("                                                                 ");System.out.println("\t\t\t2. 添 加 客 户 信 息");//不会System.out.println("                                                                 ");System.out.println("\t\t\t3. 修 改 客 户 信 息");//不会System.out.println("                                                                 ");System.out.println("\t\t\t4. 查 询 客 户 信 息");//可以有System.out.println("                                                                 ");System.out.println("\t\t\t5. 返 回 上 一 级");//可以有System.out.println("                                                                 ");System.out.println("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");System.out.println("                                                                 ");System.out.print("请输入您的选择:");      int choice3 = input.nextInt();//用一个while循环来说明没有的选项while (choice3 != 1 && choice3 != 2 && choice3 != 3 && choice3 != 4 && choice3 != 5){System.out.println("没有这个选项,请重新输入");//退出此循环if(choice3 == 1 || choice3 == 2 || choice3 == 3 || choice3 == 4 || choice3 == 5){  break;                }  }//对应 while 的大括号if (choice3 == 1) {//显示所有客户信息System.out.println("客户编号\t\t客户姓名\t\t客户生日\t\t客户积分");  System.out.println("1001\t\t"+username1+"\t\t"+birthday1+"\t\t20000");  System.out.println("1001\t\t"+username2+"\t\t"+birthday2+"\t\t25000");  System.out.println("1001\t\t"+username3+"\t\t"+birthday3+"\t\t30000");  System.out.println("1001\t\t"+username4+"\t\t"+birthday4+"\t\t10000");  System.out.println("1001\t\t"+username5+"\t\t"+birthday5+"\t\t10000");  System.out.print("请按任意键继续!");String a = input.next();continue;}if(choice3 == 2){System.out.println("系统正在升级中...");  System.out.print("按任意数字返回继续");  String b = input.next();  continue;}if (choice3 == 3){System.out.println("系统正在升级中...");  System.out.print("按任意数字返回继续");  String c = input.next();  continue;}if(choice3 ==4){  System.out.print("请输入您要查询的客户编号:");  int number = input.nextInt();//同样是做一个do-while说明没有其他的选项while (number != 1001 && number != 1002 && number != 1003 && number != 1004 && number != 1005){System.out.print("对不起,没有该选项");System.out.print("请重新输入您的选择:");  choice3 = input.nextInt();if (number == 1001 || number == 1002 || number == 1003 || number == 1004 || number == 1005){break;}}switch (number){case 1001:System.out.println("客户编号\t\t客户姓名\t\t客户生日\t\t客户积分");  System.out.println("1001\t\t"+username1+"\t\t"+birthday1+"\t\t20000");  System.out.print("按任意键返回继续");  String d = input.next();  continue;  case 1002:  System.out.println("客户编号\t\t客户姓名\t\t客户生日\t\t客户积分");  System.out.println("1002\t\t"+username2+"\t\t"+birthday2+"\t\t20000");  System.out.print("按任意键返回继续");  String e = input.next();  continue;  case 1003:  System.out.println("客户编号\t\t客户姓名\t\t客户生日\t\t客户积分");  System.out.println("1003\t\t"+username3+"\t\t"+birthday3+"\t\t20000");  System.out.print("按任意键返回继续");  String f = input.next();  continue;  case 1004:  System.out.println("客户编号\t\t客户姓名\t\t客户生日\t\t客户积分");  System.out.println("1004\t\t"+username1+"\t\t"+birthday1+"\t\t20000");  System.out.print("按任意键返回继续");  String g = input.next();  continue;  case 1005:  System.out.println("客户编号\t\t客户姓名\t\t客户生日\t\t客户积分");  System.out.println("1005\t\t"+username5+"\t\t"+birthday5+"\t\t20000");  System.out.print("按任意键返回继续");  String h = input.next();  continue;}//对应switch的大括号}//对应choice3 = 4的大括号if (choice3 == 5){continue picture2;}}//if (choice2 == 1)所对应的大括号//对应选择2购物结算if (choice2 == 2){System.out.print("欢迎进入购物系统!");System.out.print("请输入您的客户编号");}//定义上面输入的编号int number1 = input.nextInt();//第3个板块picture3:while (number1 == 1001 || number1 == 1002 || number1 == 1003 || number1 == 1004 || number1 == 1005 ){System.out.println("商城现有商品如下:");  System.out.println("商品编号\t\t商品名称\t\t商品价格");  System.out.println("1\t\t云南白药\t\t¥18.00");  System.out.println("2\t\t小米手机\t\t¥1999.00");  System.out.println("3\t\t小黑\t\t¥4998.00");  System.out.println("4\t\t拖鞋\t\t¥25.80");  System.out.println("5\t\t酱油\t\t¥5.60");  System.out.println("6\t\t汽车模型\t\t¥350.00");  System.out.println("7\t\t坦克模型\t\t¥400.00");  System.out.println("8\t\t玩具枪\t\t¥99.80");  System.out.println("请输入您要购买的产品编号");  int number2 = input.nextInt(); System.out.println("请输入您要购买的产品数量");int amount = input.nextInt();if (number1 != 1001 && number1 != 1002 && number1 != 1003 && number1 != 1004 && number1 != 1005){System.out.print("对不起,没有该选项");number2 = input.nextInt(); continue;}String name = null; double price = 0; //定义2个变量switch (number2){case 1:name = "云南白药";price = 18.00;break;case 2:name = "小米手机";price = 1998.00;break;case 3:name = "小黑";price = 4998.00;break;case 4:name = "拖鞋";price = 25.00;break;case 5:name = "酱油";price = 5.60;break;case 6:name = "汽车模型";price = 350.00;break;case 7:name = "坦克模型";price = 400.00;break;case 8:name = "玩具枪";price = 99.80;break;default:System.out.println("没有您需要的商品编号...");break;}//用户的判断if(number2 == 1001){  System.out.println("尊敬的用户:小猫");  }else if(number2 == 1002){        System.out.println("尊敬的用户:小狗");  }  else if(number2 == 1003){  System.out.println("尊敬的用户:小马");  }  else if(number2 == 1004){  System.out.println("尊敬的用户:小狐狸");  }  else if(number2 == 1005){  System.out.println("尊敬的用户:大象");}  else{  System.out.println("没有该用户...");}int value = (int)(price * amount * 0.85);//强制类型转换,可能会失精度double money = price * amount;System.out.println("尊敬的用户:小猫");System.out.println("产品名称\t\t产品单价\t\t购买数量\t\t产品总价");System.out.println(name + "\t\t" + price + "\t\t" + amount + "\t\t"+ money);System.out.println("您购买产品总价为:" + money);System.out.println("按您当前的积分,您的折扣是:0.85");System.out.println("您的应付款为:" + value);System.out.println("请付款:");double total = input.nextDouble();double change = total - value;if (total > value){System.out.println("付款成功!");System.out.println("找零:" + change);System.out.println("欢迎下次光临!");continue picture2;}else{System.out.println("请重新宠幸本系统...");}}if(choice2 == 3){System.out.println("我行我素购物管理系统>真情回馈");System.out.println("                                                                 ");System.out.println("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");System.out.println("                                                                 ");System.out.println("1. 幸 运 大 放 送");  System.out.println("                                                                 ");System.out.println("2. 幸 运 抽 奖");  System.out.println("                                                                 ");System.out.println("3. 真 情 问 候");  System.out.println("                                                                 ");System.out.println("4. 返 回 上 一 级");System.out.println("                                                                 ");System.out.println("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");System.out.println("                                                                 ");System.out.print("请输入您的选择:");  int choice4 = input.nextInt();  if(choice4 == 1){  System.out.println("积分最高的客户是:");  System.out.println("客户编号\t\t客户姓名\t\t客户生日\t\t客户积分");  System.out.println("1003\t\t小马\t\t1992-7-10\t\t30000");System.out.println("恭喜以上用户,获得价值¥5888.00的 iphoe 5S!!");  System.out.println("请按任意键继续");  String suiyi9 = input.next();  continue picture2;  }  else if(choice4 ==2){  System.out.println("积分最高的客户是:");  System.out.println("客户编号\t\t客户姓名\t\t客户生日\t\t客户积分");  System.out.println("1001\t\t小猫\t\t1992-7-10\t\t20000");  System.out.println("恭喜以上用户,获得价值¥50元的话费充值卡!!");  System.out.println("请按任意键继续");  String suiyi10 = input.next();  continue picture2;  }  else if(choice4 == 3){  System.out.println("今天没有过生日的客户");  System.out.println("请按任意键继续");  String suiyi11 = input.next();  continue picture2;  }  else{  System.out.println("对不起,没有该选项");  continue picture2;  }}//对应picture2}}}

牛刀小试(四)——较完善的购物系统相关推荐

  1. 购物系统-网上书店 javaweb jsp+Servelt+JDBC连接数据库(源码分享)

    目录 一.实现的功能 二.运行出来的结果 1.首先是一个登录页面 2.进入主界面 3.前台系统(浏览图书功能) 4.后台系统(书架维护功能) 三.实现讲解 四.代码分享 购物系统都大差不差,添加商品到 ...

  2. Java web课程设计-购物系统

    题目:网上购物系统 网上购物商店的分析与实现 一.实验目的 Java web课程设计是为了是计算机学院的学子深入学习java web应用开发设置的一门实验性的动手性的实践课程.是计算机科学与技术. 网 ...

  3. C#毕业设计——基于C#+asp.net+sqlserver基于C2C模式的网上购物系统设计与实现(毕业论文+程序源码)——网上购物系统

    基于C#+asp.net+sqlserver基于C2C模式的网上购物系统设计与实现(毕业论文+程序源码) 大家好,今天给大家介绍基于C#+asp.net+sqlserver基于C2C模式的网上购物系统 ...

  4. 基于 SSM 的网上购物系统(源码 + 开发文档 已开源)

    你能做到的,比想像的更多.  一.项目背景 这个项目是自己从四月份开始学习 Spring + SpringMVC + MyBatis 后的一次项目实践,恰好赶上学校的数据库暑期课程实践,跟老师申请后更 ...

  5. java计算机毕业设计ssm基于JAVA的网上购物系统-商城购物网站

    项目介绍  本网上购物网站是针对目前商城的实际需求,从实际工作出发,对过去的网上购物存在的问题进行分析,完善用户的使用体会.采用计算机系统来管理信息,取代人工管理模式,查询便利,信息准确率高,节省了开 ...

  6. php商城快递插件,php购物系统的插件系列之商品橱窗

    [Mcmore分销系统]认为一套完整的php购物系统是配有插件库的,而php商城系统的插件库包括有商品橱窗.广告竞投系统.CRM营销系统.搜索栏.活动组件.广告图片等插件功能.今天小编来和大家说说ph ...

  7. nodejs购物系统app-计算机毕设 附源码 90766

    nodejs购物系统app 目  录 摘要 1 绪论 1.1研究背景和意义 1.2研究现状 1.3node.js主要功能 1.4框架说明 1.5论文结构与章节安排 2购物系统app系统分析 2.1 可 ...

  8. nodejs购物系统app-计算机毕设 附源码90766

    nodejs购物系统app 目  录 摘要 1 1 绪论 1 1.1研究背景和意义 1 1.2研究现状 1 1.3node.js主要功能 1 1.4框架说明 1 1.5论文结构与章节安排 1 2购物系 ...

  9. (附源码)基于nodejs购物系统app-计算机毕设90766

    nodejs购物系统app 目  录 摘要 1 绪论 1.1研究背景和意义 1.2研究现状 1.3node.js主要功能 1.4框架说明 1.5论文结构与章节安排 2购物系统app系统分析 2.1 可 ...

最新文章

  1. python最低薪资_最低15K,最高50K,Python薪资节节高,小白怎么学?
  2. 《移动项目实践》实验报告——Android调试与上线
  3. R语言中的block Gibbs吉布斯采样贝叶斯多元线性回归
  4. 修改程序的形而上学思考(随笔)
  5. android非法字符 ufeff,Java-在Android Studi上编译时出现错误(1,1)非法字符'\ ufeff'...
  6. idea插件安装在哪个目录_从零开始编写自己需要的IntelliJ IDEA 插件
  7. linux中通用GPIO接口的操作
  8. 阿里java高级面试题
  9. 如何实现一个高速文件下载器
  10. matlab lbp特征,lbp特征(lbp纹理特征提取)
  11. 运维监控系列(4)-Prometheus控制台功能详解
  12. 艾永亮:2平米的Manner如何战胜200平米的星巴克
  13. 90后程序员职场报告:月薪普遍过万 超七成有房有车 女性程序员不足一成
  14. Qt编写安防视频监控系统10-视频轮询
  15. 来了小老弟,送40本技术畅销书!
  16. [异常退出,错误代码0xC0000005]:解决Windows应用程序崩溃的问题
  17. java虚拟机堆空间
  18. Golang图片码+压缩伪装+远程调用组合拳
  19. python底层是用什么语言实现的_我为何说Python是全栈式开发语言?
  20. B. Lorry (贪心)

热门文章

  1. springmvc文件分片上传
  2. Learning to Rotate: Quaternion Transformer for Complicated Periodical Time Series Forecasting
  3. 手机订货软件突破传统行业订货模式,让生意变得更简单!
  4. R语言 对于医学随访数据的处理 取同个id第一次随访日期和最后一次随访日期
  5. FAW Forensics Acquisition of Websites 网页爬虫工具
  6. java爬虫中split的使用_关于java中split的使用
  7. 【CSS】1049- 深入了解::before 和 ::after 伪元素
  8. 【对讲机的那点事】玩对讲机?想好了再下手,不了解入手要吃亏!
  9. 学 C++ 还是学 Java?做软件研发还需掌握哪些知识和技能?
  10. 攻防世界-MISC:base64stego