From f25a51dd1c61b91131f6439976dc88ef8224df9f Mon Sep 17 00:00:00 2001 From: Sage The DM Date: Mon, 13 Jan 2025 21:34:30 +0100 Subject: [PATCH] final version --- .../_javafx_website_task/cart.txt | 6 ------ .../main/java/com/example/CartController.java | 8 ++++++-- .../classes/com/example/CartController.class | Bin 4356 -> 4532 bytes 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/cart.txt b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/cart.txt index 00e9841..e69de29 100644 --- a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/cart.txt +++ b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/cart.txt @@ -1,6 +0,0 @@ -Lord of the Rings -Lord of the Rings -Lord of the Rings -Lord of the Rings -The Wheel of Time -The Wheel of Time diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/CartController.java b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/CartController.java index 8785177..c3a6846 100644 --- a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/CartController.java +++ b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/CartController.java @@ -67,8 +67,12 @@ public class CartController { try (BufferedReader reader = new BufferedReader(new FileReader(CART_FILE))) { String line; while ((line = reader.readLine()) != null) { - // Assuming each line contains only the book name for simplicity - cartItems.add(new Item(line, "Book Description", 1, 9.99)); + String[] parts = line.split(" - ", 2); + if (parts.length == 2) { + String name = parts[0].trim(); + String description = parts[1].trim(); + cartItems.add(new Item(name, description, 1, 9.99)); + } } } catch (IOException e) { System.err.println("Error loading cart items: " + e.getMessage()); diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/target/classes/com/example/CartController.class b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/target/classes/com/example/CartController.class index 6c2c760d362e7c85503504a6dcbfa30e3e984a49..2d279c3ae3e9668f4c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