赞
踩
- import java.util.Scanner;
-
- public class cb extends fmj_home{
- public void chengben(){
- System.out.println("请输入商品的类别:1.文具类 2.食品类 3.饮品类 4.烟草类");
- Scanner wjy=new Scanner(System.in);
- int xxx=wjy.nextInt();
- cb2 cb2=new cb2();
- while (xxx==1){
- cb2.chengben1();
- }
- cb3 cb3=new cb3();
- while (xxx==2){
- cb3.chengben2();
- }
- cb4 cb4=new cb4();
- while (xxx==3){
- cb4.chengben3();
- }
- cb5 cb5=new cb5();
- while (xxx==4){
- cb5.chengben4();
- }
-
- }
- }
- class cb2{
- public void chengben1(){
- System.out.println("请输入该文具的进货价格");
- double beilv=1.25;
- Scanner wj=new Scanner(System.in);
- double wenjv_jiage=wj.nextDouble();
- System.out.println("推荐该文具的定价应为:"+wenjv_jiage*beilv);
- double a=wenjv_jiage*beilv-wenjv_jiage;
- System.out.println("您每卖出一件该文具可净收入:"+a);
- }
- }
- class cb3{
- public void chengben2(){
- System.out.println("请输入该食品的进货价格");
- double beilv=1.4;
- Scanner sp=new Scanner(System.in);
- double shipin_jiage=sp.nextDouble();
- System.out.println("推荐该食品的定价应为:"+shipin_jiage*beilv);
- double a=shipin_jiage*beilv-shipin_jiage;
- System.out.println("您每卖出一件该食品可净收入:"+a);
-
- }
- }
- class cb4{
- public void chengben3(){
- System.out.println("请输入该饮品的进货价格");
- double beilv=1.2;
- Scanner yp=new Scanner(System.in);
- double yinpin_jiage=yp.nextDouble();
- System.out.println("推荐该饮品的定价应为:"+yinpin_jiage*beilv);
- double a=yinpin_jiage*beilv-yinpin_jiage;
- System.out.println("您每卖出一件该饮品可净收入:"+a);
-
- }
- }
- class cb5{
- public void chengben4(){
- System.out.println("请输入该饮品的进货价格");
- double beilv=1.5;
- Scanner yc=new Scanner(System.in);
- double yancao_jiage=yc.nextDouble();
- System.out.println("推荐该饮品的定价应为:"+yancao_jiage*beilv);
- double a=yancao_jiage*beilv-yancao_jiage;
- System.out.println("您每卖出一件该饮品可净收入:"+a);
-
- }
- }
- import java.util.Scanner;
-
- public class fmj_home {
- public static void main(String[] args) {
- System.out.println("请选择您想选择的功能:");
- System.out.println("1.商品成本/收入计算器");
- System.out.println("2.补货员信息 3.投诉/沟通联系方式");
- System.out.println("4.商品购买");
- Scanner wjy=new Scanner(System.in);
- int xz= wjy.nextInt();
-
- cb cb=new cb();
- while (xz==1){
- cb.chengben();
- }
- ren ren=new ren();
- while (xz==2){
- ren.yuangong();
- }
- tousu tousu=new tousu();
- while (xz==3){
- tousu.ts();
- }
- User User=new User();
- while (xz==4){
- User.USER();
- }
- }
- }
- import java.util.Scanner;
-
- public class ren extends fmj_home{
- public void yuangong(){
- System.out.println("请输入当前想查询的工作日");
- Scanner wjy=new Scanner(System.in);
- String ren= wjy.next();
- switch (ren){
- case "星期一":System.out.println("星期一工作人员:1"+" 姓名:小明"+" 联系方式:111"+" 值班时间:9.00~18.00");break;
- case "星期二":System.out.println("星期一工作人员:2"+" 姓名:小红"+" 联系方式:222"+" 值班时间:9.00~18.00");break;
- case "星期三":System.out.println("星期一工作人员:3"+" 姓名:小优"+" 联系方式:333"+" 值班时间:9.00~18.00");break;
- case "星期四":System.out.println("星期一工作人员:4"+" 姓名:小傅"+" 联系方式:444"+" 值班时间:9.00~18.00");break;
- case "星期五":System.out.println("星期一工作人员:5"+" 姓名:小陈"+" 联系方式:555"+" 值班时间:9.00~18.00");break;
- case "星期六":System.out.println("星期一工作人员:6"+" 姓名:小翁"+" 联系方式:666"+" 值班时间:9.00~18.00");break;
- case "星期日":System.out.println("星期一工作人员:7"+" 姓名:小益"+" 联系方式:777"+" 值班时间:9.00~18.00");break;
-
- }
- }
- }
- public class shopping {
- goods cola = new goods("可乐",3,10);
- goods noodles = new goods("泡面",5.5,10);
- goods ham = new goods("中华",48,10);
- goods spicy = new goods("铅笔",1.5,100);
-
- public void show(){
- System.out.println("现还有以下商品供您选择:");
- System.out.println("1、"+cola.goodsname+"\t价格:"+cola.price+"\t剩余:"+cola.number);
- System.out.println("2、"+noodles.goodsname+"\t价格:"+noodles.price+"\t剩余:"+noodles.number);
- System.out.println("3、"+ham.goodsname+"\t价格:"+ham.price+"\t剩余:"+ham.number);
- System.out.println("4、"+spicy.goodsname+"\t价格:"+spicy.price+"\t剩余:"+spicy.number);
- System.out.println("5、退出购物");
- System.out.println("6、一键补货");
- }
-
- public void show(int i){
- System.out.println("现还有以下商品供您选择:");
- System.out.println("1、"+cola.goodsname+"\t价格:"+cola.price+"\t剩余:"+cola.number);
- System.out.println("2、"+noodles.goodsname+"\t价格:"+noodles.price+"\t剩余:"+noodles.number);
- System.out.println("3、"+ham.goodsname+"\t价格:"+ham.price+"\t剩余:"+ham.number);
- System.out.println("4、"+spicy.goodsname+"\t价格:"+spicy.price+"\t剩余:"+spicy.number);
- System.out.println("5、一键补货");
- }
-
- public void shop(int choose,int num){
- switch (choose){
- case 1:
- if(cola.number == 0){
- System.out.println("已售罄,等待补货!");
- }else if (num>cola.number){
- System.out.println("库存不足,请重新选择");
- }else {
- cola.number = cola.number - num;
- success();
- }
- break;
- case 2:
- if(noodles.number == 0){
- System.out.println("已售罄,等待补货!");
- }else if (num>noodles.number){
- System.out.println("库存不足,请重新选择");
- }else {
- noodles.number = noodles.number - num;
- success();
- }
- break;
- case 3:
- if(ham.number == 0){
- System.out.println("已售罄,等待补货!");
- }else if (num>ham.number){
- System.out.println("库存不足,请重新选择");
- }else {
- ham.number = ham.number - num;
- success();
- }
- break;
- case 4:
- if(spicy.number == 0){
- System.out.println("已售罄,等待补货!");
- }else if (num>spicy.number){
- System.out.println("库存不足,请重新选择");
- }else {
- spicy.number = spicy.number - num;
- success();
- }
- break;
- case 5:
- System.out.println("欢迎下次光临!");
- break;
- case 6:
- System.out.println("补货ing......");
- this.cola.number = 10;
- this.noodles.number = 10;
- this.ham.number = 10;
- this.spicy.number = 100;
- break;
- default:
- System.out.println("没有此商品,请重新选择");
- break;
- }
- }
-
- public void shop(int choose){
- switch (choose){
- case 5:
- System.out.println("欢迎下次光临!");
- break;
- case 6:
- System.out.println("补货ing......");
- System.out.println("补货完毕");
- System.out.println();
- this.cola.number = 10;
- this.noodles.number = 10;
- this.ham.number = 10;
- this.spicy.number = 100;
- break;
- default:
- System.out.println("没有此商品,请重新选择");
- break;
- }
- }
-
- public void success(){
- System.out.println("扫码支付中。。。");
- System.out.println("正在处理。。。");
- System.out.println("购买成功!");
- }
- }
- class goods {
- String goodsname;
- double price;
- int number;
-
- public goods() {
- }
-
- public goods(String goodsname, double price, int number) {
- this.goodsname = goodsname;
- this.price = price;
- this.number = number;
- }
- }
- public class tousu extends fmj_home{
- public void ts(){
- System.out.println("投诉方式如下");
- System.out.println("1。手机号码:18789685022");
- System.out.println("2.微信:wjy020304");
- System.out.println("3.邮箱:2793456422@qq.com");
- }
- }
- import java.util.Scanner;
-
- public class User extends fmj_home{
- public void USER(){
- Scanner sc = new Scanner(System.in);
- shopping shopping = new shopping();
- System.out.println("欢迎使用自动贩卖机");
- System.out.println("是否进行购物:1、是\t2、否");
- int select = sc.nextInt();
- if (select == 1){
- shopping.show(1);
- System.out.println("请选择相应序号");
- int choose = sc.nextInt();
- while (choose >= 5){
- if (choose == 5){
- System.out.println("库存充足哟。。。");
- System.out.println("请再次选择相应序号");
- }else {
- System.out.println("没有此商品,请重新选择");
- }
- choose = sc.nextInt();
- }
- System.out.println("请输入购买数量");
- int num = sc.nextInt();
- while (true){
- shopping.shop(choose,num);
- System.out.println();
- shopping.show();
- System.out.println("如继续购物,请再次选择相应序号");
- choose = sc.nextInt();
- while (choose >= 6){
- if (choose == 6){
- shopping.shop(6);
- System.out.println("请再次选择相应序号");
- }else {
- System.out.println("没有此商品,请重新选择");
- }
- choose = sc.nextInt();
- }
- if(choose == 5){
- System.out.println("欢迎下次光临!");
- break;
- }
- System.out.println("请输入购买数量");
- num = sc.nextInt();
- }
- }else {
- System.out.println("欢迎下次光临!");
-
- }
- }
- }
-
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。