2024-10-05 15:43:26 +02:00
|
|
|
package pr2parkhaus;
|
|
|
|
|
2024-10-07 09:54:03 +02:00
|
|
|
import java.util.Scanner;
|
|
|
|
|
2024-10-05 15:43:26 +02:00
|
|
|
public class ParkhausUI {
|
|
|
|
|
2024-10-07 09:54:03 +02:00
|
|
|
Scanner in = new Scanner(System.in);
|
2024-10-05 15:43:26 +02:00
|
|
|
private ParkhausController controller;
|
|
|
|
|
|
|
|
|
|
|
|
public ParkhausUI() {
|
|
|
|
|
|
|
|
this.controller = new ParkhausController();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void start() {
|
|
|
|
|
2024-10-07 09:54:03 +02:00
|
|
|
System.out.println("Willkommen im Parkhaussystem.");
|
|
|
|
|
|
|
|
while(true) {
|
|
|
|
|
|
|
|
// Logik für die Benutzerinteraktion
|
|
|
|
System.out.println();
|
|
|
|
System.out.println("Was wollen Sie tun?");
|
|
|
|
System.out.println("a: Tarife anzeigen \t b: Auto parken \t c: Parkhaus verlassen");
|
|
|
|
System.out.println("Ihre Auswahl: ");
|
|
|
|
|
|
|
|
String auswahl = in.nextLine();
|
|
|
|
|
|
|
|
switch(auswahl.charAt(0)) {
|
|
|
|
case 'a':
|
|
|
|
System.out.println("Hier sind unsere Tarife:");
|
|
|
|
System.out.println();
|
|
|
|
showTarife();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'b':
|
|
|
|
controller.Einfahrt();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'c':
|
|
|
|
controller.Ausfahrt();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
System.out.println("Ungültige Eingabe");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-10-05 15:43:26 +02:00
|
|
|
}
|
|
|
|
|
2024-10-07 09:54:03 +02:00
|
|
|
public void showTarife() {
|
2024-10-05 15:43:26 +02:00
|
|
|
|
2024-10-07 09:54:03 +02:00
|
|
|
System.out.println(controller.getTarife());
|
2024-10-05 15:43:26 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|