Skip to content

Commit 3c2e893

Browse files
committed
ch01: 두 단계에 쪼개기 위해 함수로 추출
1 parent ba3f483 commit 3c2e893

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/kotlin/chapter01/Statement.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import java.text.NumberFormat
44
import java.util.Locale.US
55

66
fun statement(invoice: Invoice, plays: Plays): String {
7+
return renderPlainText(plays, invoice)
8+
}
9+
10+
private fun renderPlainText(plays: Plays, invoice: Invoice): String {
711
fun playFor(aPerformance: Performance): Play {
812
return plays[aPerformance.playID]!!
913
}
@@ -66,7 +70,6 @@ fun statement(invoice: Invoice, plays: Plays): String {
6670
// 청구 내역을 출력한다.
6771
result += " ${playFor(perf).name}: ${usd(amountFor(perf))} (${perf.audience}석)\n"
6872
}
69-
7073
result += "총액: ${usd(totalAmount())}\n"
7174
result += "적립 포인트: ${totalVolumeCredits()}"
7275
return result

0 commit comments

Comments
 (0)