现在有两款手机华为与小米需要做入库处理,我们需要编写一个程序来实现商品的入库,入库完成后,打印入库商品的详细信息并计算出入库商品的数量与入库商品总金额。

//华为手机
    String huaweiB="华为";
    double huaweiS=5.5;
    double huaweiP=3688.88;
    String huaweiC="8+128g 全面刘海屏";
    //小米手机
    String xiaomiB="小米";
    double xiaomiS=5.0;
    double xiaomiP=2988.88;
    String xiaomiC="4+64g 全面屏";
    //华为手机入库
    System.out.println("品牌型号:"+huaweiB);
    System.out.println("尺寸:"+huaweiS);
    System.out.println("价格:"+huaweiP);
    System.out.println("配置:"+huaweiC);
    Scanner scl =new Scanner(System.in);
    System.out.println("请输入"+huaweiB+"手机的库存");
    int huaweiCount= scl.nextInt();
    double huaweiTotal=huaweiCount*huaweiP;
    System.out.println("库存"+huaweiB+"手机的总金额:"+huaweiTotal);
    //小米手机入库
    System.out.println("品牌型号:"+xiaomiB);
    System.out.println("尺寸:"+xiaomiS);
    System.out.println("价格:"+xiaomiP);
    System.out.println("配置:"+xiaomiC);
    System.out.println("请输入"+xiaomiB+"手机的库存");
    int xiaomiCount= scl.nextInt();
    double xiaomiTotal=xiaomiCount*xiaomiP;
    System.out.println("库存"+xiaomiB+"手机的总金额:"+xiaomiTotal);
    //库存清单
    System.out.println("------------库存清单------------");
    System.out.println("品牌型号 尺寸 价格 配置 库存数 量 总价");
    System.out.println(huaweiB+"   "+huaweiS+"   "+huaweiP+" "+huaweiC+"  "+huaweiCount+" " +
            " "+huaweiTotal);
    System.out.println("---------------------------------------");
    int total=huaweiCount+xiaomiCount;
    double totalMoney=huaweiTotal+xiaomiTotal;
    //总库存数量与库存总价
    System.out.println("总库存:"+total);
    System.out.println("库存总结:"+totalMoney+"¥");
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值