package shangchengkucunqingdananli;
/*
* 商城库存清单案例
* 变量的形式对商品的数据保存
* 品牌,尺寸大小,价格,配置,库存数量
* 三个商品 苹果,thinkpad,华硕
*
* 计算出总的库存数,和商品的总金额
*/
public class StoreList {
public static void main(String[] args) {
//笔记本电脑
String macBrand = "MacBookAir";
double macSize = 13.3;
double macPrice = 6699.9;
String macConfig = "i5处理器4GB内存12GB固定硬盘";
int macCount = 5;
//联想ThinkPad笔记本电脑
String thinkpadBrand = "ThinkpadT420";
double thinkpadSize = 14.0;
double thinkpadPrice = 6299.9;
String thinkpadConfig = "i7处理器4GB内存16GB固定硬盘";
int thinkpadCount = 8;
//华硕ASUS笔记本电脑
String ASUSBrand = "ASUS-FL10";
double ASUSSize = 15.6;
double ASUSPrice = 5999.9;
String ASUSConfig = "i8处理器4GB内存128GB固定硬盘";
int ASUSCount = 10;
//列表的顶部
System.out.println("----------------------商城库存清单----------------------");
System.out.println("品牌型号 尺寸 价格 配置 库存数");
//列表中部
System.out.println(macBrand + " "+ macSize + " " + macPrice + " " + macConfig + " " + macCount + " ");
System.out.println(thinkpadBrand + " "+ thinkpadSize + " " + thinkpadPrice + " " + thinkpadConfig + " " + thinkpadCount + " ");
System.out.println(ASUSBrand + " "+ ASUSSize + " " + ASUSPrice + " " + ASUSConfig + " " + ASUSCount + " ");
//统计总库存数 总库存数金额
int totalCount = macCount + thinkpadCount + ASUSCount;
double totalMoney = (macPrice*macCount) + (thinkpadPrice*thinkpadCount) + (ASUSPrice*ASUSCount);
//数列底部
System.out.println("--------------------------------------------------");
System.out.println("总库存是:"+totalCount);
System.out.println("库存商品总金额:"+totalMoney);
}
}
打印出来的的样子
标签:库存,Java,String,double,System,----,println,清单,out From: https://blog.51cto.com/u_15943742/6106464