-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathChecklist.java
More file actions
64 lines (53 loc) · 1.86 KB
/
Checklist.java
File metadata and controls
64 lines (53 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.cpucode.java;/*
* @Author: cpu_code
* @Date: 2020-07-08 10:45:02
* @LastEditTime: 2020-07-08 10:45:54
* @FilePath: \java\basics\Checklist.java
* @Gitee: https://gitee.com/cpu_code
* @CSDN: https://blog.csdn.net/qq_44226094
*/
/**
* 商城库存清单程序
--------------------------Checklist--------------------------------
types Price num
MacBookAir 6988.88 5
ThinkpadT450 5999.99 10
ASUS-FL5800 4999.5 18
------------------------------------------------------------------
sum_num == 33
Price_sun == 184935.3
*/
public class Checklist
{
public static void main(String[] args)
{
// 苹果笔记本电脑
String macBrand = "MacBookAir";
double macPrice = 6988.88;
int macCount = 5;
// 联想Thinkpad笔记本电脑
String thinkpadBrand = "ThinkpadT450";
double thinkpadPrice = 5999.99;
int thinkpadCount = 10;
// 华硕ASUS笔记本电脑
String ASUSBrand = "ASUS-FL5800";
double ASUSPrice = 4999.50;
int ASUSCount = 18;
// 列表顶部
System.out.println("--------------------------Checklist--------------------------------");
System.out.println("types Price num");
// 列表中部
System.out.println(macBrand + " " + macPrice + " " + macCount);
System.out.println(thinkpadBrand+ " " + thinkpadPrice + " " + thinkpadCount);
System.out.println(ASUSBrand + " " + ASUSPrice + " " + ASUSCount);
// 统计总库存数、库存总金额
int totalCount = macCount + thinkpadCount + ASUSCount;
double totalMoney = (macCount * macPrice) +
(thinkpadCount * thinkpadPrice) +
(ASUSCount * ASUSPrice);
// 列表底部
System.out.println("------------------------------------------------------------------");
System.out.println("sum_num == " + totalCount);
System.out.println("Price_sun == " + totalMoney);
}
}