60 lines
2.2 KiB
Java
60 lines
2.2 KiB
Java
package pckg;
|
|
import pckg.Backend.OnlineShop;
|
|
import pckg.Backend.Warenkorb;
|
|
|
|
import java.util.Scanner;
|
|
import java.io.FileNotFoundException;
|
|
|
|
|
|
public class shopTUI {
|
|
|
|
private OnlineShop shop;
|
|
private Scanner sc = new Scanner(System.in);
|
|
|
|
public void main(String[] args) throws FileNotFoundException {
|
|
System.out.println("Willkommen bei Ihrem vertreiber für Alltägliches");
|
|
|
|
shop = new OnlineShop();
|
|
mainMenu();
|
|
}
|
|
|
|
public void mainMenu() throws FileNotFoundException {
|
|
System.out.println("\n-----------Hauptmenü-----------");
|
|
System.out.println("----------------------------------");
|
|
System.out.println(" Produktangebot ");
|
|
System.out.println(" Produktsuche ");
|
|
System.out.println(" Warenkorb ");
|
|
System.out.println(" Beenden ");
|
|
System.out.println("-----------------------------------\n");
|
|
System.out.print("Bitte geben Sie eine der Optionen an: ");
|
|
|
|
boolean rekursiv = true;
|
|
while(rekursiv){
|
|
System.out.println("\nWas möchten Sie tun? (produktangebot, produktsuche, warenkorb, beenden): ");
|
|
String eingabe = sc.nextLine().toLowerCase();
|
|
switch (eingabe) {
|
|
case "produktangebot":
|
|
shop.angebot();
|
|
// Nach shop.angebot() springt er automatisch zum Schleifenanfang
|
|
break;
|
|
|
|
case "produktsuche":
|
|
shop.suche();
|
|
break;
|
|
|
|
case "warenkorb":
|
|
shop.showCart();
|
|
break;
|
|
|
|
case "beenden":
|
|
System.out.println("\n Auf Wiedersehen! ");
|
|
rekursiv = false; // Beendet die Schleife
|
|
break;
|
|
|
|
default:
|
|
System.out.println("\nUngültige Eingabe, bitte versuchen Sie es erneut.");
|
|
}
|
|
}
|
|
}
|
|
}
|