diff options
| author | Kamal Wickramanayake <kamal@inbox.lk> | 2026-03-22 21:31:29 +0530 |
|---|---|---|
| committer | Kamal Wickramanayake <kamal@inbox.lk> | 2026-03-22 21:31:29 +0530 |
| commit | 5f5ac2c4ce62370257a26c5f15dbef577f4bc1c7 (patch) | |
| tree | 2b8cf5b2fdf9c8df124d4f8f64b33c876d1b55d2 /oop/10-point-of-sale/src/lk/ac/pdn | |
| parent | 3ffd9370c8c7ebf34232ef59568981cdc3856a05 (diff) | |
Deleted oop/10-point-of-sale since 11-point-of-sale has been added
Diffstat (limited to 'oop/10-point-of-sale/src/lk/ac/pdn')
8 files changed, 0 insertions, 210 deletions
diff --git a/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/App.java b/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/App.java deleted file mode 100644 index c3f1037..0000000 --- a/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/App.java +++ /dev/null @@ -1,16 +0,0 @@ -package lk.ac.pdn.ceit.pos;
-
-import lk.ac.pdn.ceit.pos.item.InMemoryItemManager;
-import lk.ac.pdn.ceit.pos.item.ItemManager;
-
-public class App {
- public static void main(String[] args) throws Exception {
- ItemManager itemManager = new InMemoryItemManager();
-
- PointOfSale pos = new PointOfSale(itemManager);
-
- TextUI ui = new TextUI(pos);
-
- ui.start();
- }
-}
diff --git a/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/PointOfSale.java b/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/PointOfSale.java deleted file mode 100644 index dfac6e1..0000000 --- a/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/PointOfSale.java +++ /dev/null @@ -1,33 +0,0 @@ -package lk.ac.pdn.ceit.pos; - -import lk.ac.pdn.ceit.pos.entities.Bill; -import lk.ac.pdn.ceit.pos.entities.Item; -import lk.ac.pdn.ceit.pos.entities.LineItem; -import lk.ac.pdn.ceit.pos.item.ItemManager; - -public class PointOfSale { - - private ItemManager itemManager; - - private Bill bill; - - public PointOfSale(ItemManager itemManager) { - this.itemManager = itemManager; - } - - public Bill createNewBill() { - bill = new Bill(); - return bill; - } - - public void addLineItem(String itemId, int quantity) { - // From the ItemManager, get the Item. - Item item = itemManager.findById(itemId); - - // Create a new LineItem and associate it with the item returned - LineItem lineItem = new LineItem(item, quantity); - - // Add the new LineItem to the bill - bill.getLineItems().add(lineItem); - } -} diff --git a/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/TextUI.java b/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/TextUI.java deleted file mode 100644 index 056e41e..0000000 --- a/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/TextUI.java +++ /dev/null @@ -1,27 +0,0 @@ -package lk.ac.pdn.ceit.pos; - -import lk.ac.pdn.ceit.pos.entities.Bill; - -public class TextUI { - private PointOfSale pos; - - public TextUI(PointOfSale pos) { - this.pos = pos; - } - - public void start() { - IO.println("POS Started."); - - // Assume a bill should be created. - Bill bill = pos.createNewBill(); - - // Assume: Create a line item - pos.addLineItem("F001", 2); - - pos.addLineItem("F002", 3); - - // ... - - // Print bill - } -} diff --git a/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/entities/Bill.java b/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/entities/Bill.java deleted file mode 100644 index ad6a87e..0000000 --- a/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/entities/Bill.java +++ /dev/null @@ -1,17 +0,0 @@ -package lk.ac.pdn.ceit.pos.entities; - -import java.util.ArrayList; -import java.util.List; - -public class Bill { - private List<LineItem> lineItems = new ArrayList<>(); - - public List<LineItem> getLineItems() { - return lineItems; - } - - public void setLineItems(List<LineItem> lineItems) { - this.lineItems = lineItems; - } - -} diff --git a/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/entities/Item.java b/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/entities/Item.java deleted file mode 100644 index 47b8e32..0000000 --- a/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/entities/Item.java +++ /dev/null @@ -1,34 +0,0 @@ -package lk.ac.pdn.ceit.pos.entities; - -public class Item { - private String name; - private String id; - private double unitPrice; - - public Item(String name, String id, double unitPrice) { - this.name = name; - this.id = id; - this.unitPrice = unitPrice; - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - public double getUnitPrice() { - return unitPrice; - } - public void setUnitPrice(double unitPrice) { - this.unitPrice = unitPrice; - } - - -} diff --git a/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/entities/LineItem.java b/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/entities/LineItem.java deleted file mode 100644 index ad6abaf..0000000 --- a/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/entities/LineItem.java +++ /dev/null @@ -1,29 +0,0 @@ -package lk.ac.pdn.ceit.pos.entities; - -public class LineItem { - private Item item; - private int quantity; - - public LineItem(Item item, int quantity) { - this.item = item; - this.quantity = quantity; - } - - public Item getItem() { - return item; - } - - public void setItem(Item item) { - this.item = item; - } - - public int getQuantity() { - return quantity; - } - - public void setQuantity(int quantity) { - this.quantity = quantity; - } - - -} diff --git a/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/item/InMemoryItemManager.java b/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/item/InMemoryItemManager.java deleted file mode 100644 index 00bc835..0000000 --- a/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/item/InMemoryItemManager.java +++ /dev/null @@ -1,43 +0,0 @@ -package lk.ac.pdn.ceit.pos.item; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import lk.ac.pdn.ceit.pos.entities.Item; - -public class InMemoryItemManager implements ItemManager { - - // Assume this is the item storage - private Map<String, Item> items = new HashMap<>(); - - // Initial set of data for demo purposes - public InMemoryItemManager() { - this.create("Dhal", "F001", 300.00); - this.create("Bread", "F002", 180.00); - this.create("Sunlight Soap", "S001", 150.00); - } - - @Override - public Item findById(String id) { - return items.get(id); - } - - @Override - public List<Item> searchByName(String word) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'searchByName'"); - } - - @Override - public Item create(String name, String id, double unitPrice) { - // Create a new Item - Item item = new Item(name, id, unitPrice); - - // Add to storage - items.put(id, item); - - return item; - } - -} diff --git a/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/item/ItemManager.java b/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/item/ItemManager.java deleted file mode 100644 index 5c6b47e..0000000 --- a/oop/10-point-of-sale/src/lk/ac/pdn/ceit/pos/item/ItemManager.java +++ /dev/null @@ -1,11 +0,0 @@ -package lk.ac.pdn.ceit.pos.item; - -import java.util.List; - -import lk.ac.pdn.ceit.pos.entities.Item; - -public interface ItemManager { - public Item findById(String id); - public List<Item> searchByName(String word); - public Item create(String name, String id, double unitPrice); -} |
