Update Technikladen/OrderSystem.java

Removed package line
This commit is contained in:
Igor Bartkowski 2024-10-14 19:06:53 +02:00
parent ddc485ddeb
commit f66f633416

@ -1,57 +1,55 @@
package tech_store; import java.util.ArrayList;
import java.util.ArrayList; public class OrderSystem {
private StorageManager systemManager;
public class OrderSystem { private ArrayList<Client> systemClients;
private StorageManager systemManager; public OrderSystem(StorageManager manager, ArrayList<Client> clients) {
private ArrayList<Client> systemClients; this.systemManager = manager;
public OrderSystem(StorageManager manager, ArrayList<Client> clients) { this.systemClients = clients;
this.systemManager = manager; }
this.systemClients = clients; public void addProduct(Product product) {
} this.systemManager.addProduct(product);
public void addProduct(Product product) { }
this.systemManager.addProduct(product); public void addClient(Client client) {
} this.systemClients.add(client);
public void addClient(Client client) { }
this.systemClients.add(client); public Client getClientByID(int id) {
} for (Client client : this.systemClients) {
public Client getClientByID(int id) { if (client.getID() == id) {
for (Client client : this.systemClients) { return client;
if (client.getID() == id) { }
return client; }
} return new Client("", "");
} }
return new Client("", ""); public void createOrder(int id, Order order) {
} this.getClientByID(id).addOrder(order);
public void createOrder(int id, Order order) { }
this.getClientByID(id).addOrder(order); public ArrayList<Client> getClients() {
} return this.systemClients;
public ArrayList<Client> getClients() { }
return this.systemClients; public Product getProductByID(int id) {
} for (Product product : this.systemManager.getStorage()) {
public Product getProductByID(int id) { if (product.getID() == id) {
for (Product product : this.systemManager.getStorage()) { return product;
if (product.getID() == id) { }
return product; }
} return new Product(-1, "", 0, 0);
} }
return new Product(-1, "", 0, 0); public StorageManager getManager() {
} return this.systemManager;
public StorageManager getManager() { }
return this.systemManager; public void showClients() {
} for (Client client : this.systemClients) {
public void showClients() { System.out.println(client.toString());
for (Client client : this.systemClients) { }
System.out.println(client.toString()); }
} public void showProducts() {
} if (this.systemManager.getStorage().isEmpty()) {
public void showProducts() { System.out.println("No products exist");
if (this.systemManager.getStorage().isEmpty()) { return;
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());
for (Product product : this.systemManager.getStorage()) { }
System.out.println("ID: " + product.getID() + ", Name: " + product.getName() + ", Price: " + product.getPrice() + ", Amount: " + product.getAmount()); }
}
}
} }