商城库存清单程序设计
package 商城库存清单程序设计;
public class StoreList {
public static void main(String[] args) {
String macBrand="MacBookAir"; //苹果笔记本电脑
double macSize=13.3;
double macPrice=6988.88;
String macConfig="i5处理器4GB内存128G固态硬盘";
int macCount=5;
String thinkpadBrand="ThankpadT450"; //联想Thinkpad笔记本电脑
double thinkpadSize=14.0;
double thinkpadPrice=5999.99;
String thinkpadConfig="i5处理器4GB内存128G固态硬盘";
int thinkpadCount=10;
String ASUSBrand="ASUS-FL5800"; //华硕ASUS笔记本电脑
double ASUSSize=15.6;
double ASUSPrize=4999.50;
String ASUSConfig="i7处理器4GB内存128G固态硬盘";
int ASUSCount=18;
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+""+ASUSPrize+""+ASUSConfig+""+ASUSCount);
int totalCount=macCount+thinkpadCount+ASUSCount;
double totalMoney=(macCount*macPrice)+(thinkpadCount*thinkpadPrice)+(ASUSCount*4999.50);
System.out.println("------------"+"-----------------------"); //列表底部
System.out.println("总库存数:"+totalCount);
System.out.println("库存商品总金额:"+totalMoney);
}
}
结果:

浙公网安备 33010602011771号