final version
This commit is contained in:
		
							parent
							
								
									772f952ea3
								
							
						
					
					
						commit
						f25a51dd1c
					
				
					 3 changed files with 6 additions and 8 deletions
				
			
		|  | @ -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 |  | ||||||
|  | @ -67,8 +67,12 @@ public class CartController { | ||||||
|         try (BufferedReader reader = new BufferedReader(new FileReader(CART_FILE))) { |         try (BufferedReader reader = new BufferedReader(new FileReader(CART_FILE))) { | ||||||
|             String line; |             String line; | ||||||
|             while ((line = reader.readLine()) != null) { |             while ((line = reader.readLine()) != null) { | ||||||
|                 // Assuming each line contains only the book name for simplicity |                 String[] parts = line.split(" - ", 2); | ||||||
|                 cartItems.add(new Item(line, "Book Description", 1, 9.99)); |                 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) { |         } catch (IOException e) { | ||||||
|             System.err.println("Error loading cart items: " + e.getMessage()); |             System.err.println("Error loading cart items: " + e.getMessage()); | ||||||
|  |  | ||||||
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Sage The DM
						Sage The DM