From f66f633416be84925fd8efb0728a75f2c9b726c4 Mon Sep 17 00:00:00 2001 From: ibartkowski Date: Mon, 14 Oct 2024 19:06:53 +0200 Subject: [PATCH] Update Technikladen/OrderSystem.java Removed package line --- Technikladen/OrderSystem.java | 110 +++++++++++++++++----------------- 1 file changed, 54 insertions(+), 56 deletions(-) diff --git a/Technikladen/OrderSystem.java b/Technikladen/OrderSystem.java index ca37ec1..c111eac 100755 --- a/Technikladen/OrderSystem.java +++ b/Technikladen/OrderSystem.java @@ -1,57 +1,55 @@ -package tech_store; - -import java.util.ArrayList; - -public class OrderSystem { - private StorageManager systemManager; - private ArrayList systemClients; - public OrderSystem(StorageManager manager, ArrayList clients) { - this.systemManager = manager; - this.systemClients = clients; - } - public void addProduct(Product product) { - this.systemManager.addProduct(product); - } - public void addClient(Client client) { - this.systemClients.add(client); - } - public Client getClientByID(int id) { - for (Client client : this.systemClients) { - if (client.getID() == id) { - return client; - } - } - return new Client("", ""); - } - public void createOrder(int id, Order order) { - this.getClientByID(id).addOrder(order); - } - public ArrayList getClients() { - return this.systemClients; - } - public Product getProductByID(int id) { - for (Product product : this.systemManager.getStorage()) { - if (product.getID() == id) { - return product; - } - } - return new Product(-1, "", 0, 0); - } - public StorageManager getManager() { - return this.systemManager; - } - public void showClients() { - for (Client client : this.systemClients) { - System.out.println(client.toString()); - } - } - public void showProducts() { - if (this.systemManager.getStorage().isEmpty()) { - System.out.println("No products exist"); - return; - } - for (Product product : this.systemManager.getStorage()) { - System.out.println("ID: " + product.getID() + ", Name: " + product.getName() + ", Price: " + product.getPrice() + ", Amount: " + product.getAmount()); - } - } +import java.util.ArrayList; + +public class OrderSystem { + private StorageManager systemManager; + private ArrayList systemClients; + public OrderSystem(StorageManager manager, ArrayList clients) { + this.systemManager = manager; + this.systemClients = clients; + } + public void addProduct(Product product) { + this.systemManager.addProduct(product); + } + public void addClient(Client client) { + this.systemClients.add(client); + } + public Client getClientByID(int id) { + for (Client client : this.systemClients) { + if (client.getID() == id) { + return client; + } + } + return new Client("", ""); + } + public void createOrder(int id, Order order) { + this.getClientByID(id).addOrder(order); + } + public ArrayList getClients() { + return this.systemClients; + } + public Product getProductByID(int id) { + for (Product product : this.systemManager.getStorage()) { + if (product.getID() == id) { + return product; + } + } + return new Product(-1, "", 0, 0); + } + public StorageManager getManager() { + return this.systemManager; + } + public void showClients() { + for (Client client : this.systemClients) { + System.out.println(client.toString()); + } + } + public void showProducts() { + if (this.systemManager.getStorage().isEmpty()) { + System.out.println("No products exist"); + return; + } + for (Product product : this.systemManager.getStorage()) { + System.out.println("ID: " + product.getID() + ", Name: " + product.getName() + ", Price: " + product.getPrice() + ", Amount: " + product.getAmount()); + } + } } \ No newline at end of file