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 6c2c760..2d279c3 100644 Binary files a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/target/classes/com/example/CartController.class and b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/target/classes/com/example/CartController.class differ