当前位置:   article > 正文

自动贩卖机管理系统_自动售货机系统管理

自动售货机系统管理
  1. import java.util.Scanner;
  2. public class cb extends fmj_home{
  3. public void chengben(){
  4. System.out.println("请输入商品的类别:1.文具类 2.食品类 3.饮品类 4.烟草类");
  5. Scanner wjy=new Scanner(System.in);
  6. int xxx=wjy.nextInt();
  7. cb2 cb2=new cb2();
  8. while (xxx==1){
  9. cb2.chengben1();
  10. }
  11. cb3 cb3=new cb3();
  12. while (xxx==2){
  13. cb3.chengben2();
  14. }
  15. cb4 cb4=new cb4();
  16. while (xxx==3){
  17. cb4.chengben3();
  18. }
  19. cb5 cb5=new cb5();
  20. while (xxx==4){
  21. cb5.chengben4();
  22. }
  23. }
  24. }
  25. class cb2{
  26. public void chengben1(){
  27. System.out.println("请输入该文具的进货价格");
  28. double beilv=1.25;
  29. Scanner wj=new Scanner(System.in);
  30. double wenjv_jiage=wj.nextDouble();
  31. System.out.println("推荐该文具的定价应为:"+wenjv_jiage*beilv);
  32. double a=wenjv_jiage*beilv-wenjv_jiage;
  33. System.out.println("您每卖出一件该文具可净收入:"+a);
  34. }
  35. }
  36. class cb3{
  37. public void chengben2(){
  38. System.out.println("请输入该食品的进货价格");
  39. double beilv=1.4;
  40. Scanner sp=new Scanner(System.in);
  41. double shipin_jiage=sp.nextDouble();
  42. System.out.println("推荐该食品的定价应为:"+shipin_jiage*beilv);
  43. double a=shipin_jiage*beilv-shipin_jiage;
  44. System.out.println("您每卖出一件该食品可净收入:"+a);
  45. }
  46. }
  47. class cb4{
  48. public void chengben3(){
  49. System.out.println("请输入该饮品的进货价格");
  50. double beilv=1.2;
  51. Scanner yp=new Scanner(System.in);
  52. double yinpin_jiage=yp.nextDouble();
  53. System.out.println("推荐该饮品的定价应为:"+yinpin_jiage*beilv);
  54. double a=yinpin_jiage*beilv-yinpin_jiage;
  55. System.out.println("您每卖出一件该饮品可净收入:"+a);
  56. }
  57. }
  58. class cb5{
  59. public void chengben4(){
  60. System.out.println("请输入该饮品的进货价格");
  61. double beilv=1.5;
  62. Scanner yc=new Scanner(System.in);
  63. double yancao_jiage=yc.nextDouble();
  64. System.out.println("推荐该饮品的定价应为:"+yancao_jiage*beilv);
  65. double a=yancao_jiage*beilv-yancao_jiage;
  66. System.out.println("您每卖出一件该饮品可净收入:"+a);
  67. }
  68. }
  1. import java.util.Scanner;
  2. public class fmj_home {
  3. public static void main(String[] args) {
  4. System.out.println("请选择您想选择的功能:");
  5. System.out.println("1.商品成本/收入计算器");
  6. System.out.println("2.补货员信息 3.投诉/沟通联系方式");
  7. System.out.println("4.商品购买");
  8. Scanner wjy=new Scanner(System.in);
  9. int xz= wjy.nextInt();
  10. cb cb=new cb();
  11. while (xz==1){
  12. cb.chengben();
  13. }
  14. ren ren=new ren();
  15. while (xz==2){
  16. ren.yuangong();
  17. }
  18. tousu tousu=new tousu();
  19. while (xz==3){
  20. tousu.ts();
  21. }
  22. User User=new User();
  23. while (xz==4){
  24. User.USER();
  25. }
  26. }
  27. }
  1. import java.util.Scanner;
  2. public class ren extends fmj_home{
  3. public void yuangong(){
  4. System.out.println("请输入当前想查询的工作日");
  5. Scanner wjy=new Scanner(System.in);
  6. String ren= wjy.next();
  7. switch (ren){
  8. case "星期一":System.out.println("星期一工作人员:1"+" 姓名:小明"+" 联系方式:111"+" 值班时间:9.00~18.00");break;
  9. case "星期二":System.out.println("星期一工作人员:2"+" 姓名:小红"+" 联系方式:222"+" 值班时间:9.00~18.00");break;
  10. case "星期三":System.out.println("星期一工作人员:3"+" 姓名:小优"+" 联系方式:333"+" 值班时间:9.00~18.00");break;
  11. case "星期四":System.out.println("星期一工作人员:4"+" 姓名:小傅"+" 联系方式:444"+" 值班时间:9.00~18.00");break;
  12. case "星期五":System.out.println("星期一工作人员:5"+" 姓名:小陈"+" 联系方式:555"+" 值班时间:9.00~18.00");break;
  13. case "星期六":System.out.println("星期一工作人员:6"+" 姓名:小翁"+" 联系方式:666"+" 值班时间:9.00~18.00");break;
  14. case "星期日":System.out.println("星期一工作人员:7"+" 姓名:小益"+" 联系方式:777"+" 值班时间:9.00~18.00");break;
  15. }
  16. }
  17. }
  1. public class shopping {
  2. goods cola = new goods("可乐",3,10);
  3. goods noodles = new goods("泡面",5.5,10);
  4. goods ham = new goods("中华",48,10);
  5. goods spicy = new goods("铅笔",1.5,100);
  6. public void show(){
  7. System.out.println("现还有以下商品供您选择:");
  8. System.out.println("1、"+cola.goodsname+"\t价格:"+cola.price+"\t剩余:"+cola.number);
  9. System.out.println("2、"+noodles.goodsname+"\t价格:"+noodles.price+"\t剩余:"+noodles.number);
  10. System.out.println("3、"+ham.goodsname+"\t价格:"+ham.price+"\t剩余:"+ham.number);
  11. System.out.println("4、"+spicy.goodsname+"\t价格:"+spicy.price+"\t剩余:"+spicy.number);
  12. System.out.println("5、退出购物");
  13. System.out.println("6、一键补货");
  14. }
  15. public void show(int i){
  16. System.out.println("现还有以下商品供您选择:");
  17. System.out.println("1、"+cola.goodsname+"\t价格:"+cola.price+"\t剩余:"+cola.number);
  18. System.out.println("2、"+noodles.goodsname+"\t价格:"+noodles.price+"\t剩余:"+noodles.number);
  19. System.out.println("3、"+ham.goodsname+"\t价格:"+ham.price+"\t剩余:"+ham.number);
  20. System.out.println("4、"+spicy.goodsname+"\t价格:"+spicy.price+"\t剩余:"+spicy.number);
  21. System.out.println("5、一键补货");
  22. }
  23. public void shop(int choose,int num){
  24. switch (choose){
  25. case 1:
  26. if(cola.number == 0){
  27. System.out.println("已售罄,等待补货!");
  28. }else if (num>cola.number){
  29. System.out.println("库存不足,请重新选择");
  30. }else {
  31. cola.number = cola.number - num;
  32. success();
  33. }
  34. break;
  35. case 2:
  36. if(noodles.number == 0){
  37. System.out.println("已售罄,等待补货!");
  38. }else if (num>noodles.number){
  39. System.out.println("库存不足,请重新选择");
  40. }else {
  41. noodles.number = noodles.number - num;
  42. success();
  43. }
  44. break;
  45. case 3:
  46. if(ham.number == 0){
  47. System.out.println("已售罄,等待补货!");
  48. }else if (num>ham.number){
  49. System.out.println("库存不足,请重新选择");
  50. }else {
  51. ham.number = ham.number - num;
  52. success();
  53. }
  54. break;
  55. case 4:
  56. if(spicy.number == 0){
  57. System.out.println("已售罄,等待补货!");
  58. }else if (num>spicy.number){
  59. System.out.println("库存不足,请重新选择");
  60. }else {
  61. spicy.number = spicy.number - num;
  62. success();
  63. }
  64. break;
  65. case 5:
  66. System.out.println("欢迎下次光临!");
  67. break;
  68. case 6:
  69. System.out.println("补货ing......");
  70. this.cola.number = 10;
  71. this.noodles.number = 10;
  72. this.ham.number = 10;
  73. this.spicy.number = 100;
  74. break;
  75. default:
  76. System.out.println("没有此商品,请重新选择");
  77. break;
  78. }
  79. }
  80. public void shop(int choose){
  81. switch (choose){
  82. case 5:
  83. System.out.println("欢迎下次光临!");
  84. break;
  85. case 6:
  86. System.out.println("补货ing......");
  87. System.out.println("补货完毕");
  88. System.out.println();
  89. this.cola.number = 10;
  90. this.noodles.number = 10;
  91. this.ham.number = 10;
  92. this.spicy.number = 100;
  93. break;
  94. default:
  95. System.out.println("没有此商品,请重新选择");
  96. break;
  97. }
  98. }
  99. public void success(){
  100. System.out.println("扫码支付中。。。");
  101. System.out.println("正在处理。。。");
  102. System.out.println("购买成功!");
  103. }
  104. }
  105. class goods {
  106. String goodsname;
  107. double price;
  108. int number;
  109. public goods() {
  110. }
  111. public goods(String goodsname, double price, int number) {
  112. this.goodsname = goodsname;
  113. this.price = price;
  114. this.number = number;
  115. }
  116. }
  1. public class tousu extends fmj_home{
  2. public void ts(){
  3. System.out.println("投诉方式如下");
  4. System.out.println("1。手机号码:18789685022");
  5. System.out.println("2.微信:wjy020304");
  6. System.out.println("3.邮箱:2793456422@qq.com");
  7. }
  8. }
  1. import java.util.Scanner;
  2. public class User extends fmj_home{
  3. public void USER(){
  4. Scanner sc = new Scanner(System.in);
  5. shopping shopping = new shopping();
  6. System.out.println("欢迎使用自动贩卖机");
  7. System.out.println("是否进行购物:1、是\t2、否");
  8. int select = sc.nextInt();
  9. if (select == 1){
  10. shopping.show(1);
  11. System.out.println("请选择相应序号");
  12. int choose = sc.nextInt();
  13. while (choose >= 5){
  14. if (choose == 5){
  15. System.out.println("库存充足哟。。。");
  16. System.out.println("请再次选择相应序号");
  17. }else {
  18. System.out.println("没有此商品,请重新选择");
  19. }
  20. choose = sc.nextInt();
  21. }
  22. System.out.println("请输入购买数量");
  23. int num = sc.nextInt();
  24. while (true){
  25. shopping.shop(choose,num);
  26. System.out.println();
  27. shopping.show();
  28. System.out.println("如继续购物,请再次选择相应序号");
  29. choose = sc.nextInt();
  30. while (choose >= 6){
  31. if (choose == 6){
  32. shopping.shop(6);
  33. System.out.println("请再次选择相应序号");
  34. }else {
  35. System.out.println("没有此商品,请重新选择");
  36. }
  37. choose = sc.nextInt();
  38. }
  39. if(choose == 5){
  40. System.out.println("欢迎下次光临!");
  41. break;
  42. }
  43. System.out.println("请输入购买数量");
  44. num = sc.nextInt();
  45. }
  46. }else {
  47. System.out.println("欢迎下次光临!");
  48. }
  49. }
  50. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/380261
推荐阅读
相关标签
  

闽ICP备14008679号