diff --git a/Restaurantverwaltung/src/Bestellsystem.java b/Restaurantverwaltung/src/Bestellsystem.java index f5eef5c..3645f60 100644 --- a/Restaurantverwaltung/src/Bestellsystem.java +++ b/Restaurantverwaltung/src/Bestellsystem.java @@ -24,79 +24,106 @@ public class Bestellsystem { System.out.print("Bitte gib die Tischnummer ein: "); String tischNummer = scanner.nextLine(); Bestellung bestellung = new Bestellung(tischNummer); - while (true) { - // Gericht auswählen - System.out.print("Bitte bestelle ein Gericht (oder 'fertig', um abzuschließen): "); - String gericht = scanner.nextLine(); - boolean istVerfuegbar = false; - - // Wenn der Benutzer 'fertig' eingibt, wird die Bestellung gespeichert - if (gericht.equalsIgnoreCase("fertig")) { - speichereBestellung(bestellung); - System.out.println("Bestand wurde aktualisiert"); - break; - } - - // Überprüfen, ob das Gericht im Menü verfügbar ist - try { - for (Dish dish : menu.getDishes()) { - if (gericht.equalsIgnoreCase(dish.getName())) { - // Zutaten für das Gericht verwenden (Bestand aktualisieren) - SystemController.inventory.useIngredients(dish.getIngredients()); - bestellung.addGericht(gericht); // Gericht zur Bestellung hinzufügen - istVerfuegbar = true; - bestellungen.add(bestellung); // Bestellung zur Liste der Bestellungen hinzufügen - System.out.println("Bestellung wurde aktualisiert"); - System.out.println(bestellung.getBestellungDetails()); // Bestellungsdetails anzeigen - break; - } - } - } catch (Exception e) { - System.out.println("Fehler beim Hinzufügen des Gerichts zur Bestellung: " + e.getMessage()); - } - - // Wenn das Gericht nicht im Menü ist, eine Fehlermeldung anzeigen - if (!istVerfuegbar) { - System.out.println("Gericht ist nicht im Menü."); - } - } - } - - - public static void loescheBestellung() { - ladeUndZeigeBestellungen(); - - System.out.print("Gib die ID der zu löschenden Bestellung ein: "); - String id = scanner.nextLine(); - - Bestellung zuLoeschen = null; - - for (Bestellung bestellung : bestellungen) { - if (bestellung.getId().equals(id)) { - zuLoeschen = bestellung; +// List Gerichte = new ArrayList<>(menu.getDishes()); +// try (BufferedReader reader = new BufferedReader(new FileReader(STOCK_FILE))) { +// String line; +// while ((line = reader.readLine()) != null) { +// String[] parts = line.split(","); +// +// String name = parts[0]; +// Integer count = Integer.parseInt(parts[1]); +// stock.put(name, count); +// +// } +// } catch (FileNotFoundException e) { +// System.out.println("Stockdatenbank nicht gefunden. Einträge müssen manuell erstellt werden"); +// +// } catch (IOException e) { +// System.out.println("Fehler beim Lesen der Benutzerdatenbank: " + e.getMessage()); +// } +// for (Dish gericht : Gerichte) { +// if (stock.containsKey(gericht.getName())) { +// if (stock.get(gericht.getName()) < ) +// } +// } + System.out.print("Bitte bestelle ein Gericht (oder 'fertig', um abzuschließen): "); + String gericht = scanner.nextLine(); + boolean istVerfuegbar = false; + if (gericht.equalsIgnoreCase("fertig")) { + speichereBestellung(bestellung); + System.out.println("Bestand wurde aktualisiert"); break; } - } + try { for (Dish dish : menu.getDishes()) { + if (gericht.equalsIgnoreCase(dish.getName())) { + SystemController.inventory.useIngredients(dish.getIngredients()); + bestellung.addGericht(gericht); + istVerfuegbar = true; + bestellungen.add(bestellung); + System.out.println("Bestellung wurde aktualisiert"); + System.out.println(bestellung.getBestellungDetails()); - if (zuLoeschen != null) { - bestellungen.remove(zuLoeschen); - aktualisiereDatei(); - System.out.println("Bestellung wurde gelöscht."); - } else { - System.out.println("Keine Bestellung mit der angegebenen ID gefunden."); - } - } - - private static void aktualisiereDatei() { - try (FileWriter writer = new FileWriter(FILE_PATH, false)) { - for (Bestellung bestellung : bestellungen) { - writer.write(bestellung.toFileFormat()); + } + // else { +// System.out.println("Ist nicht verfügbar"); +// } + }} catch (Exception e ) { + } - } catch (IOException e) { - System.out.println("Fehler beim Aktualisieren der Datei: " + e.getMessage()); + if (istVerfuegbar == false) { + System.out.println("Gericht ist nicht im Menu"); + } + +// while (true) { +// System.out.print("Möchte der Kunde noch einen Zusatzwunsch für dieses Gericht? (ja/nein): "); +// String wunschAntwort = scanner.nextLine(); +// +// if (wunschAntwort.equalsIgnoreCase("ja")) { +// System.out.print("Bitte gib den Zusatzwunsch ein (z.B. 'keine Tomaten'): "); +// String zusatzWunsch = scanner.nextLine(); +// bestellung.addZusatzWunsch(zusatzWunsch); +// } else if (wunschAntwort.equalsIgnoreCase("nein")) { +// break; +// } +// } + } } + + public static void loescheBestellung() { + ladeUndZeigeBestellungen(); + + System.out.print("Gib die ID der zu löschenden Bestellung ein: "); + String id = scanner.nextLine(); + + Bestellung zuLoeschen = null; + + for (Bestellung bestellung : bestellungen) { + if (bestellung.getId().equals(id)) { + zuLoeschen = bestellung; + break; + } + } + + if (zuLoeschen != null) { + bestellungen.remove(zuLoeschen); + aktualisiereDatei(); + System.out.println("Bestellung wurde gelöscht."); + } else { + System.out.println("Keine Bestellung mit der angegebenen ID gefunden."); + } + } + private static void aktualisiereDatei() { + try (FileWriter writer = new FileWriter(FILE_PATH, false)) { + for (Bestellung bestellung : bestellungen) { + writer.write(bestellung.toFileFormat()); + } + } catch (IOException e) { + System.out.println("Fehler beim Aktualisieren der Datei: " + e.getMessage()); + } + } + public static void speichereBestellung(Bestellung bestellung) { try { diff --git a/Restaurantverwaltung/src/Bestellungen.txt b/Restaurantverwaltung/src/Bestellungen.txt index 9109d75..8fa5319 100644 --- a/Restaurantverwaltung/src/Bestellungen.txt +++ b/Restaurantverwaltung/src/Bestellungen.txt @@ -12,37 +12,3 @@ Bestellte Gerichte: Zeit: 16:13 -------------------------- -ID: 657b07cf-3416-43a6-9477-8f057541caeb -Tisch Nummer: 01 -Bestellte Gerichte: - -Zeit: 17:13 --------------------------- -ID: 13b6908f-6b5e-4ed5-9d83-a01913bf0608 -Tisch Nummer: Ramen -Bestellte Gerichte: - -Zeit: 17:25 --------------------------- -ID: dbe203a2-da99-4420-8095-999f79d37eaa -Tisch Nummer: Cheeseburger -Bestellte Gerichte: - -Zeit: 17:28 --------------------------- -ID: f72aa0bf-d739-4e72-9654-add74abc3cea -Tisch Nummer: 01 -Bestellte Gerichte: -- Cheeseburger -- Ramen -- Ramen - -Zeit: 17:33 --------------------------- -ID: 8adf6247-e041-46fd-86ee-2773b2eb69fe -Tisch Nummer: 01 -Bestellte Gerichte: -- Cheeseburger - -Zeit: 17:42 --------------------------- diff --git a/Restaurantverwaltung/src/Dish.java b/Restaurantverwaltung/src/Dish.java index 973b0ea..3e8f78d 100644 --- a/Restaurantverwaltung/src/Dish.java +++ b/Restaurantverwaltung/src/Dish.java @@ -1,14 +1,11 @@ -import java.util.Map; - +import java.util.*; class Dish { private String name; private Map ingredients; - private double price; // Preis für jedes Gericht - public Dish(String name, Map ingredients, double price) { + public Dish(String name, Map ingredients) { this.name = name; this.ingredients = ingredients; - this.price = price; } public String getName() { @@ -18,8 +15,4 @@ class Dish { public Map getIngredients() { return ingredients; } - - public double getPrice() { - return price; - } -} +} \ No newline at end of file diff --git a/Restaurantverwaltung/src/FinancialManager.java b/Restaurantverwaltung/src/FinancialManager.java index 5232bfb..8085e87 100644 --- a/Restaurantverwaltung/src/FinancialManager.java +++ b/Restaurantverwaltung/src/FinancialManager.java @@ -1,92 +1,144 @@ -import java.time.LocalDate; -import java.util.HashMap; -import java.util.Map; +import java.io.*; +import java.text.SimpleDateFormat; +import java.util.*; -public class FinancialManager { - private double totalRevenue; - private double totalExpenses; - private double totalProfit; - private Map dailyRevenue = new HashMap<>(); - private Map weeklyRevenue = new HashMap<>(); - private Map monthlyRevenue = new HashMap<>(); - private Map dailyExpenses = new HashMap<>(); - private Map weeklyExpenses = new HashMap<>(); - private Map monthlyExpenses = new HashMap<>(); +class FinancialManager { + private static final String TRANSACTION_FILE = "src/transactions.txt"; // Datei für Transaktionen (Einnahmen und Ausgaben) + private List transactions = new ArrayList<>(); - // Methode zur Hinzufügung von Einnahmen - public void addRevenue(double amount) { - this.totalRevenue += amount; - LocalDate today = LocalDate.now(); - dailyRevenue.put(today, dailyRevenue.getOrDefault(today, 0.0) + amount); - - // Einnahmen für die Woche und den Monat aktualisieren - LocalDate startOfWeek = today.minusDays(today.getDayOfWeek().getValue() - 1); - weeklyRevenue.put(startOfWeek, weeklyRevenue.getOrDefault(startOfWeek, 0.0) + amount); - - LocalDate startOfMonth = today.withDayOfMonth(1); - monthlyRevenue.put(startOfMonth, monthlyRevenue.getOrDefault(startOfMonth, 0.0) + amount); + public FinancialManager() { + loadTransactionsFromFile(); } - // Methode zur Hinzufügung von Ausgaben - public void addExpense(double amount) { - this.totalExpenses += amount; - LocalDate today = LocalDate.now(); - dailyExpenses.put(today, dailyExpenses.getOrDefault(today, 0.0) + amount); - - // Ausgaben für die Woche und den Monat aktualisieren - LocalDate startOfWeek = today.minusDays(today.getDayOfWeek().getValue() - 1); - weeklyExpenses.put(startOfWeek, weeklyExpenses.getOrDefault(startOfWeek, 0.0) + amount); - - LocalDate startOfMonth = today.withDayOfMonth(1); - monthlyExpenses.put(startOfMonth, monthlyExpenses.getOrDefault(startOfMonth, 0.0) + amount); + public void recordTransaction(double amount, String description, boolean isIncome) { + Date date = new Date(); + Transaction transaction = new Transaction(amount, description, isIncome, date); + transactions.add(transaction); + saveTransactionToFile(transaction); } - // Methode zur Berechnung der Einnahmen für einen bestimmten Zeitraum - public double getRevenueForPeriod(String period) { - LocalDate today = LocalDate.now(); - switch (period.toLowerCase()) { - case "daily": - return dailyRevenue.getOrDefault(today, 0.0); - case "weekly": - LocalDate startOfWeek = today.minusDays(today.getDayOfWeek().getValue() - 1); - return weeklyRevenue.getOrDefault(startOfWeek, 0.0); - case "monthly": - LocalDate startOfMonth = today.withDayOfMonth(1); - return monthlyRevenue.getOrDefault(startOfMonth, 0.0); - default: - return 0.0; + private void saveTransactionToFile(Transaction transaction) { + try (BufferedWriter writer = new BufferedWriter(new FileWriter(TRANSACTION_FILE, true))) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String transactionLine = dateFormat.format(transaction.getDate()) + ";" + transaction.getAmount() + ";" + transaction.getDescription() + ";" + (transaction.isIncome() ? "Income" : "Expense"); + writer.write(transactionLine); + writer.newLine(); + } catch (IOException e) { + System.out.println("Fehler beim Speichern der Transaktion: " + e.getMessage()); } } - // Methode zur Berechnung der Ausgaben für einen bestimmten Zeitraum - public double getExpensesForPeriod(String period) { - LocalDate today = LocalDate.now(); - switch (period.toLowerCase()) { - case "daily": - return dailyExpenses.getOrDefault(today, 0.0); - case "weekly": - LocalDate startOfWeek = today.minusDays(today.getDayOfWeek().getValue() - 1); - return weeklyExpenses.getOrDefault(startOfWeek, 0.0); - case "monthly": - LocalDate startOfMonth = today.withDayOfMonth(1); - return monthlyExpenses.getOrDefault(startOfMonth, 0.0); - default: - return 0.0; + private void loadTransactionsFromFile() { + try (BufferedReader reader = new BufferedReader(new FileReader(TRANSACTION_FILE))) { + String line; + while ((line = reader.readLine()) != null) { + String[] parts = line.split(";"); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date date = dateFormat.parse(parts[0]); + double amount = Double.parseDouble(parts[1]); + String description = parts[2]; + boolean isIncome = "Income".equals(parts[3]); + transactions.add(new Transaction(amount, description, isIncome, date)); + } + } catch (IOException | java.text.ParseException e) { + System.out.println("Fehler beim Laden der Transaktionen: " + e.getMessage()); } } - // Getter für Gesamtumsatz - public double getTotalRevenue() { - return totalRevenue; + public void showFinancialReport(String period) { + double totalIncome = 0; + double totalExpense = 0; + Date startDate = null; + Date endDate = new Date(); + + switch (period.toLowerCase()) { + case "daily": + startDate = getStartOfDay(); + break; + case "weekly": + startDate = getStartOfWeek(); + break; + case "monthly": + startDate = getStartOfMonth(); + break; + default: + System.out.println("Ungültige Zeitraumoption!"); + return; + } + + // Berechnen der Einnahmen und Ausgaben im angegebenen Zeitraum + for (Transaction transaction : transactions) { + if (!transaction.getDate().before(startDate) && !transaction.getDate().after(endDate)) { + if (transaction.isIncome()) { + totalIncome += transaction.getAmount(); + } else { + totalExpense += transaction.getAmount(); + } + } + } + + System.out.println("\n--- Finanzbericht für " + period + " ---"); + System.out.println("Gesamte Einnahmen: " + totalIncome + " EUR"); + System.out.println("Gesamte Ausgaben: " + totalExpense + " EUR"); + System.out.println("Nettogewinn: " + (totalIncome - totalExpense) + " EUR"); } - // Getter für Gesamtausgaben - public double getTotalExpenses() { - return totalExpenses; + private Date getStartOfDay() { + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.HOUR_OF_DAY, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); } - // Berechnung des Nettogewinns - public double getNetProfit() { - return totalRevenue - totalExpenses; + private Date getStartOfWeek() { + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); + cal.set(Calendar.HOUR_OF_DAY, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); + } + + private Date getStartOfMonth() { + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.DAY_OF_MONTH, 1); + cal.set(Calendar.HOUR_OF_DAY, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); + } +} + +class Transaction { + private double amount; + private String description; + private boolean isIncome; + private Date date; + + public Transaction(double amount, String description, boolean isIncome, Date date) { + this.amount = amount; + this.description = description; + this.isIncome = isIncome; + this.date = date; + } + + public double getAmount() { + return amount; + } + + public String getDescription() { + return description; + } + + public boolean isIncome() { + return isIncome; + } + + public Date getDate() { + return date; } } diff --git a/Restaurantverwaltung/src/Inventory.java b/Restaurantverwaltung/src/Inventory.java index e00158b..ba6ff17 100644 --- a/Restaurantverwaltung/src/Inventory.java +++ b/Restaurantverwaltung/src/Inventory.java @@ -1,141 +1,129 @@ -import java.io.*; import java.util.*; +import java.io.*; -public class Inventory { +class Inventory { + private Map stock; + private final String STOCK_FILE = "src/stock.txt"; + + - private Map stock = new HashMap<>(); - private FinancialManager financialManager; // Deklaration der Instanzvariable - - public Inventory(FinancialManager financialManager) { - this.financialManager = financialManager; // Initialisierung des FinancialManagers im Konstruktor - } - - private final String STOCK_FILE = "src/stock.txt"; // Datei für den Bestand - - // Lädt den Bestand aus der Datei public void loadStockFromFile() { - stock.clear(); + stock = new HashMap<>(); try (BufferedReader reader = new BufferedReader(new FileReader(STOCK_FILE))) { String line; while ((line = reader.readLine()) != null) { - String[] parts = line.split(":"); - if (parts.length == 2) { - String ingredientName = parts[0]; - int quantity = Integer.parseInt(parts[1]); - stock.put(ingredientName, quantity); - } + String[] parts = line.split(","); + + String name = parts[0]; + Integer count = Integer.parseInt(parts[1]); + stock.put(name, count); + } } catch (FileNotFoundException e) { - System.out.println("Bestand-Datei nicht gefunden, neue Datei wird erstellt."); + System.out.println("Stockdatenbank nicht gefunden. Einträge müssen manuell erstellt werden"); + } catch (IOException e) { - System.out.println("Fehler beim Laden des Bestands: " + e.getMessage()); + System.out.println("Fehler beim Lesen der Benutzerdatenbank: " + e.getMessage()); } } - // Speichert den aktuellen Bestand in die Datei public void saveStockToFile() { try (BufferedWriter writer = new BufferedWriter(new FileWriter(STOCK_FILE))) { for (Map.Entry entry : stock.entrySet()) { - writer.write(entry.getKey() + ":" + entry.getValue()); + writer.write(entry.getKey() + "," + entry.getValue()); writer.newLine(); } } catch (IOException e) { - System.out.println("Fehler beim Speichern des Bestands: " + e.getMessage()); + System.out.println("Fehler beim Speichern der Datei: " + e.getMessage()); } } - // Zeigt den aktuellen Bestand an + public Inventory() { + + } + public void viewStock() { - if (stock.isEmpty()) { - System.out.println("Der Bestand ist leer."); - } else { - System.out.println("\n--- Aktueller Bestand ---"); - for (Map.Entry entry : stock.entrySet()) { - System.out.println(entry.getKey() + ": " + entry.getValue() + " Stück"); - } + System.out.println("Aktueller Bestand:"); + for (Map.Entry entry : stock.entrySet()) { + System.out.println(entry.getKey() + ": " + entry.getValue()); } } - - // Bestellmenge verringern (z.B. beim Bestellen) - public void useIngredients(Map usedIngredients) { - for (Map.Entry entry : usedIngredients.entrySet()) { - String ingredientName = entry.getKey(); - int amountUsed = entry.getValue(); - if (stock.containsKey(ingredientName)) { - int currentStock = stock.get(ingredientName); - if (currentStock >= amountUsed) { - stock.put(ingredientName, currentStock - amountUsed); - } else { - System.out.println("Nicht genügend Bestand für " + ingredientName); - } - } else { - System.out.println("Zutat " + ingredientName + " existiert nicht im Bestand."); - } - } - } - - // Bestand erweitern und berechnen, ob Ausgaben hinzuzufügen sind - public void addIngredients(String productName, int amountToAdd, FinancialManager financialManager) { - double ingredientCost = 1.0; // Beispielhafter Preis für Zutaten (z.B. 1 Euro pro Stück) - - // Addiere die Zutaten zum Bestand - stock.put(productName, stock.getOrDefault(productName, 0) + amountToAdd); - - // Berechne die Ausgaben für die Erweiterung des Bestands - double totalCost = ingredientCost * amountToAdd; - - // Gebe die Kosten in den Finanzen an - financialManager.addExpense(totalCost); - - System.out.println("Bestand für " + productName + " wurde um " + amountToAdd + " Stück erhöht."); - } - - // Gibt den Preis für eine bestimmte Zutat zurück (Beispielpreise) - private double getPriceForIngredient(String ingredientName) { - switch (ingredientName.toLowerCase()) { - case "salat": - return 1.5; // Preis für Salat pro Einheit - case "tomaten": - return 0.8; // Preis für Tomaten pro Einheit - case "cheeseburger": - return 3.0; // Preis für Cheeseburger pro Einheit - default: - return 1.0; // Standardpreis pro Einheit - } - } - - // In der Inventory-Klasse: + public boolean showIngredientsAvailable(Map ingredients) { - for (Map.Entry entry : ingredients.entrySet()) { - String ingredient = entry.getKey(); - int requiredAmount = entry.getValue(); + for (Map.Entry entry : ingredients.entrySet()) { + String ingredient = entry.getKey(); + int amount = entry.getValue(); - // Überprüfe, ob der Lagerbestand ausreicht - if (!stock.containsKey(ingredient) || stock.get(ingredient) < requiredAmount) { - System.out.println("Nicht genügend Bestand für: " + ingredient); // Fehlermeldung - return false; - } - } - return true; + if (!stock.containsKey(ingredient) || stock.get(ingredient) < amount) { + return false; + } + } + + return true; } + public void useIngredients(Map ingredients) { + + for (Map.Entry entry : ingredients.entrySet()) { + stock.put(entry.getKey(), stock.get(entry.getKey()) - entry.getValue()); + saveStockToFile(); + } + + } - public void overwriteStock(String productName, int newAmount) { - if (stock.containsKey(productName)) { - stock.put(productName, newAmount); - System.out.println("Der Bestand für " + productName + " wurde auf " + newAmount + " Stück geändert."); + // Neue Methode: Zutaten hinzufügen + public void addIngredients(String ingredient, int amount) { + if (amount <= 0) { + System.out.println("Ungültige Menge: " + amount); + return; + } + stock.put(ingredient, stock.getOrDefault(ingredient, 0) + amount); + System.out.println(amount + " " + ingredient + " hinzugefügt."); + } + + // Neue Methode: Zutaten entfernen + public void removeIngredient(String ingredient) { + if (stock.containsKey(ingredient)) { + stock.remove(ingredient); + System.out.println(ingredient + " wurde aus dem Lager entfernt."); } else { - System.out.println("Das Produkt " + productName + " existiert nicht im Bestand."); + System.out.println(ingredient + " ist nicht im Lager vorhanden."); } } - // Getter für den Bestand - public Map getStock() { - return stock; + // Neue Methode: Gesamten Bestand prüfen + public int totalStock() { + int total = 0; + for (int amount : stock.values()) { + total += amount; + } + return total; } - // Setter für den Bestand - public void setStock(Map stock) { - this.stock = stock; + // Neue Methode: Warnungen bei niedrigem Bestand + public void lowStockWarning(int threshold) { + System.out.println("Warnung: Niedriger Bestand bei folgenden Zutaten:"); + for (Map.Entry entry : stock.entrySet()) { + if (entry.getValue() < threshold) { + System.out.println(entry.getKey() + ": " + entry.getValue()); + } + } } -} + + + + // Neue Methode: Zutatenbestand überschreiben + public void overwriteStock(String ingredient, int amount) { + if (amount < 0) { + System.out.println("Ungültige Menge: " + amount); + return; + } + if (stock.containsKey(ingredient)) { + stock.put(ingredient, amount); + System.out.println(ingredient + " Bestand auf " + amount + " gesetzt."); + } else { + System.out.println(ingredient + " ist nicht im Lager vorhanden. Hinzufügen mit neuer Menge."); + stock.put(ingredient, amount); + } + } +} \ No newline at end of file diff --git a/Restaurantverwaltung/src/Menu.java b/Restaurantverwaltung/src/Menu.java index 78355b6..5c734cf 100644 --- a/Restaurantverwaltung/src/Menu.java +++ b/Restaurantverwaltung/src/Menu.java @@ -1,18 +1,17 @@ import java.util.*; -public class Menu { - public List dishes = new ArrayList<>(); - public List availableDishes = new ArrayList<>(); +class Menu { + public List dishes = new ArrayList<>(); + public List availableDishes = new ArrayList<>(); - public Menu() { - - dishes.add(new Dish("Cheeseburger", Map.of("Brot", 1, "Fleisch", 1, "Käse", 1), 5.0)); - dishes.add(new Dish("Veggie-Burger", Map.of("Brot", 1, "Salat", 1, "Tomaten", 1), 4.0)); - dishes.add(new Dish("Double Meat Burger", Map.of("Brot", 1, "Fleisch", 2), 6.0)); - dishes.add(new Dish("Ramen", Map.of("Soße", 1, "Salat", 1, "Tomaten", 1, "Nudeln", 30), 7.0)); - } + public Menu() { + + dishes.add(new Dish("Cheeseburger", Map.of("Brot", 1, "Fleisch", 1, "Käse", 1))); + dishes.add(new Dish("Veggie-Burger", Map.of("Brot", 1, "Salat", 1, "Tomaten", 1))); + dishes.add(new Dish("Double Meat Burger", Map.of("Brot", 1, "Fleisch", 2))); + dishes.add(new Dish("Ramen", Map.of("Soße", 1, "Salat", 1, "Tomaten", 1, "Nudeln", 30))); + } - public void displayMenu(Inventory inventory) { System.out.println("Verfügbares Menü:"); for (Dish dish : dishes) { diff --git a/Restaurantverwaltung/src/SystemController.java b/Restaurantverwaltung/src/SystemController.java index 22fcfb8..f0e8742 100644 --- a/Restaurantverwaltung/src/SystemController.java +++ b/Restaurantverwaltung/src/SystemController.java @@ -272,4 +272,4 @@ class SystemController { default -> System.out.println("Ungültige Auswahl."); } } -**/} +} diff --git a/Restaurantverwaltung/src/stock.txt b/Restaurantverwaltung/src/stock.txt index d6250c7..7c6ef85 100644 --- a/Restaurantverwaltung/src/stock.txt +++ b/Restaurantverwaltung/src/stock.txt @@ -1,7 +1,8 @@ -Tomaten:100 -Salat:260 -Käse:100 -Brot:100 -Soße:100 -Fleisch:200 -Nudeln:150 +01,100 +Soße,49999996 +Ananasdasdas,5000 +Brot,1503 +Tomaten,503 +Käse,715 +Fleisch,93 +Salat,494