Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3fbfbeb

Browse files
authored
Update RunLittleSupperMarketAppMain.java
1 parent 470290e commit 3fbfbeb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

第二章 Java面向对象编程/09. 打造一个小超市/code/src/com/geekbang/RunLittleSupperMarketAppMain.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ public static void main(String[] args) {
109109

110110
// 钱也够,货也够
111111
// 更新顾客此次消费的总额
112-
totalCost += toBuy.count * toBuy.soldPrice;
112+
// 应该是 numToBuy * m.soldPrice 而不是 numToBuy * m.purchasePrice . 鸣谢 @Geek_421d56 帮忙活捉bug一只.
113+
totalCost += numToBuy.count * toBuy.soldPrice;
113114
// 更新商品库存
114115
toBuy.count -= numToBuy;
115116
// 更新今日销货数据

0 commit comments

Comments
 (0)