Skip to content

Commit 2533d1b

Browse files
authored
docs: 1주차 요구사항
1 parent dede7b7 commit 2533d1b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

chap/전략패턴/요구사항.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## 원본 코드
2+
3+
~~~
4+
5+
public class Calculator {
6+
public int calculate(boolean firstGuest, List<Item> items) {
7+
int sum = 0; for (Item item : items) {
8+
if (firstGuest) {
9+
sum += (int) (item.getPrice() * 0.9); // 첫 손님 할인
10+
} else if (!item.isFresh()) {
11+
sum += (int) (item.getPirce() * 0.8); // 덜 신선한 것 20% 할인
12+
} else {
13+
sum += item.getPrice();
14+
}
15+
return sum;
16+
}
17+
}
18+
19+
~~~

0 commit comments

Comments
 (0)