From f64ee2fb321170312b02f9c316e3ced7e4f840e3 Mon Sep 17 00:00:00 2001 From: Peter Kofler Date: Tue, 13 Feb 2024 22:00:35 +0100 Subject: [PATCH] Demonstrate Peel. --- .../java/org/codecop/dependencies/c/Checkout.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Java/src/main/java/org/codecop/dependencies/c/Checkout.java b/Java/src/main/java/org/codecop/dependencies/c/Checkout.java index feef608..967f625 100644 --- a/Java/src/main/java/org/codecop/dependencies/c/Checkout.java +++ b/Java/src/main/java/org/codecop/dependencies/c/Checkout.java @@ -3,15 +3,20 @@ public class Checkout { public Receipt createReceipt(Money amount) { + Receipt receipt = create(amount); + + store(receipt); + + return receipt; + } + + protected Receipt create(Money amount) { Receipt receipt = new Receipt(); Money vat = amount.percentage(20); receipt.setAmount(amount); receipt.setTax(vat); receipt.setTotal(amount.add(vat)); - - store(receipt); - return receipt; }