zoukankan      html  css  js  c++  java
  • Java(命令行)打印库存清单

    public class demo{
    public static void main(String[] args){
    //1 顶部
    System.out.println("----------------商城库存清单------------------------------------------------");
    System.out.println("品牌 尺寸 价格 库存数量");
    //2 品牌
    String macBrand = "MacBookAir";
    double macSize = 15.6;
    double macPrice = 9888.3;
    int maccount = 6;
    
    String ThinkBrand = "ThinkPadT450";
    double ThinkSize = 15.6;
    double ThinkPrice = 19888.3;
    int thinkcount = 2;
    
    String MiBrand = "ThinkPadT450";
    double MiSize = 15.6;
    double MiPrice = 19888.3;
    int Micount = 10;
    //3 打印中部
    System.out.println(macBrand+" "+macSize+" "+macPrice+" "+maccount);
    System.out.println(ThinkBrand+" "+ThinkSize+" "+ThinkPrice+" "+thinkcount);
    System.out.println(MiBrand+" "+MiSize+" "+MiPrice+" "+Micount);
    int total = maccount+thinkcount+Micount;
    double totalPrice = maccount*macPrice+ThinkPrice*thinkcount+Micount*MiPrice;
    //4 打印底部
    System.out.println("库存总数"+total);
    System.out.println("库存总价格"+totalPrice);







    }

  • 相关阅读:
    android启动模式2
    acvitity的日常 启动模式(上)
    Fragment 切换问题
    异常处理
    Xutils的使用 转载 带自己细细研究
    hibernate 增删改
    OGNL
    JDBC
    Struts 文件的上传与下载
    ActionContext和ServletActionContext小结
  • 原文地址:https://www.cnblogs.com/duguangming/p/10497882.html
Copyright © 2011-2022 走看看