java商品入库

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String H_name = "华为";
        double H_size = 5.5;
        double H_price = 3688.88;
        String H_configuration = "8+128g 全面刘海屏";
        System.out.print("请输入华为手机库存: ");
        int H_inventory = scanner.nextInt();

        String X_name = "小米";
        double X_size = 5.0;
        double X_price = 2988.88;
        int X_inventory;  // 声明X_inventory
        String X_configuration = "4+64g 全面屏";  // 声明X_configuration
        System.out.print("请输入小米手机库存: ");
        X_inventory = scanner.nextInt();  // 初始化X_inventory

        System.out.println("品牌型号:" + H_name);
        System.out.println("尺寸:" + H_size);
        System.out.println("价格:" + H_price);
        System.out.println("配置:" + H_configuration);
        System.out.println("库存: " + H_inventory);
        System.out.println("库存华为手机的总金额: " + H_inventory * H_price);

        System.out.println("品牌型号:" + X_name);
        System.out.println("尺寸:" + X_size);
        System.out.println("价格:" + X_price);
        System.out.println("配置:" + X_configuration);
        System.out.println("库存数量: " + X_inventory);
        System.out.println("库存小米手机的总金额: " + X_inventory * X_price);

        System.out.println("------------库存清单-----------");
        System.out.println("品牌型号    尺寸    价格          配置     库存数量    总价");
        System.out.println(H_name + "\t" + H_size + "\t" + H_price + "\t" + H_configuration + "\t" + H_inventory + "\t" + H_inventory * H_price);
        System.out.println(X_name + "\t" + X_size + "\t" + X_price + "\t" + X_configuration + "\t" + X_inventory + "\t" + X_inventory * X_price);
        System.out.println("------------------------------------");
        System.out.println("总库存:"+(H_inventory + X_inventory));
        System.out.println("库存总价:"+((H_inventory * H_price) + (X_inventory * X_price)) + "¥");

    }
}

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值