From 922f11e7218a4faddf9842a1a3aa62ecd7eddad5 Mon Sep 17 00:00:00 2001 From: Kevin Huang Date: Mon, 11 Sep 2023 11:07:48 +0200 Subject: [PATCH 1/3] krythuang - added the domain-model.md file --- domain-model.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 domain-model.md diff --git a/domain-model.md b/domain-model.md new file mode 100644 index 0000000..32c2e8a --- /dev/null +++ b/domain-model.md @@ -0,0 +1,26 @@ +# Example Domain Model + +## User Story + +``` +As a supermarket shopper, +So that I can pay for products at checkout, +I'd like to be able to know the total cost of items in my basket. +``` + +``` +As an organised individual, +So that I can evaluate my shopping habits, +I'd like to see an itemised receipt that includes the name and price of the products +I bought as well as the quantity, and a total cost of my basket. +``` + +## Domain Model + +| Classes | Attributes | Methods | | +|--------------------|----------------------------------------------------------|---------------------------|---| +| SupermarketShopper | Name | initialize name | | +| Basket | ArrayList products | add product to basket | | +| | | calculate final price | | +| Product | Hashmap with products and prices | initialize name and price | | +| Receipt | ArrayList products, price, quantity, total costs | generate receipt | | From ea4a50dfc0047fda685a847a83c96f1424a5a691 Mon Sep 17 00:00:00 2001 From: Kevin Huang Date: Mon, 11 Sep 2023 11:35:24 +0200 Subject: [PATCH 2/3] Kevin Huang - changed the domain model --- domain-model.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/domain-model.md b/domain-model.md index 32c2e8a..38c768c 100644 --- a/domain-model.md +++ b/domain-model.md @@ -17,10 +17,15 @@ I bought as well as the quantity, and a total cost of my basket. ## Domain Model -| Classes | Attributes | Methods | | -|--------------------|----------------------------------------------------------|---------------------------|---| -| SupermarketShopper | Name | initialize name | | -| Basket | ArrayList products | add product to basket | | -| | | calculate final price | | -| Product | Hashmap with products and prices | initialize name and price | | -| Receipt | ArrayList products, price, quantity, total costs | generate receipt | | +| Class | Attributes | Methods | Scenario | Results | +|------------------|---------------------------------------------|---------------------------------------------------|-------------------------------------------------|--------------------------------------------------------------| +| Shopper | - basket: List\ | - addToBasket(product: Product) | A shopper adds products to their basket. | Product is added to the basket. | +| | | - getBasketTotalCost(): double | A shopper wants to know the total cost. | The total cost of the basket is calculated and returned. | +| | | - generateReceipt(): Receipt | A shopper wants to see an itemized receipt. | An itemized receipt is generated and returned. | +| Product | - name: String | - getPrice(): double | A shopper needs to know the price of a product.| The price of the product is retrieved. | +| | - price: double | | | | +| Receipt | - items: List\ | - addItem(item: ReceiptItem) | Items are added to the receipt. | Item is added to the receipt. | +| | | - calculateTotalCost(): double | A shopper wants to calculate the total cost. | The total cost of the receipt is calculated and returned. | +| ReceiptItem | - product: Product | | | | +| | - quantity: int | | | | +| | | | | | From 04d8f837374a7084315ca728a080825ee0aaa843 Mon Sep 17 00:00:00 2001 From: Kevin Huang Date: Mon, 11 Sep 2023 11:37:21 +0200 Subject: [PATCH 3/3] made even more changes --- domain-model.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/domain-model.md b/domain-model.md index 38c768c..8903f13 100644 --- a/domain-model.md +++ b/domain-model.md @@ -17,15 +17,15 @@ I bought as well as the quantity, and a total cost of my basket. ## Domain Model -| Class | Attributes | Methods | Scenario | Results | -|------------------|---------------------------------------------|---------------------------------------------------|-------------------------------------------------|--------------------------------------------------------------| -| Shopper | - basket: List\ | - addToBasket(product: Product) | A shopper adds products to their basket. | Product is added to the basket. | -| | | - getBasketTotalCost(): double | A shopper wants to know the total cost. | The total cost of the basket is calculated and returned. | -| | | - generateReceipt(): Receipt | A shopper wants to see an itemized receipt. | An itemized receipt is generated and returned. | -| Product | - name: String | - getPrice(): double | A shopper needs to know the price of a product.| The price of the product is retrieved. | -| | - price: double | | | | -| Receipt | - items: List\ | - addItem(item: ReceiptItem) | Items are added to the receipt. | Item is added to the receipt. | -| | | - calculateTotalCost(): double | A shopper wants to calculate the total cost. | The total cost of the receipt is calculated and returned. | -| ReceiptItem | - product: Product | | | | -| | - quantity: int | | | | -| | | | | | +| Class | Attributes | Methods | Scenario | Results | +|------------------|--------------------------------|----------------------------------|------------------------------------------------|-----------------------------------------------------------| +| Shopper | - basket: List\ | - addToBasket(product: Product) | A shopper adds products to their basket. | Product is added to the basket. | +| | | - getBasketTotalCost(): double | A shopper wants to know the total cost. | The total cost of the basket is calculated and returned. | +| | | - generateReceipt(): Receipt | A shopper wants to see an itemized receipt. | An itemized receipt is generated and returned. | +| Product | - name: String | - getPrice(): double | A shopper needs to know the price of a product.| The price of the product is retrieved. | +| | - price: double | | | | +| Receipt | - items: List\ | - addItem(item: ReceiptItem) | Items are added to the receipt. | Item is added to the receipt. | +| | | - calculateTotalCost(): double | A shopper wants to calculate the total cost. | The total cost of the receipt is calculated and returned. | +| ReceiptItem | - product: Product | | | | +| | - quantity: int | | | | +| | | | | |