Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Blatt 5 Gruppe JP0147 Martin Kozialkowski, Marcel Weber
- import java.util.Scanner;
- public class Hausaufgabe6 {
- public static void anzeigen() {
- System.out.println("Diese Funktion steht noch nicht zur Verfügung!");
- }
- public static void hinzufuegen() {
- // <<Dokumente hinzufügen>>
- }
- public static void loeschen() {
- Scanner eingabe = new Scanner(System.in);
- //<<Suche Datei aus>>
- System.out.println("Möchten Sie die Datei wirklich löschen?");
- System.out.println("<1> JA");
- System.out.println("<2> NEIN");
- int abfrage = eingabe.nextInt();
- /* if (abfrage == 1) {
- * // <<Lösche die Datei>>
- * } else {
- * weitermachen = true;
- * }
- */
- }
- public static void beenden() {
- Scanner eingabe = new Scanner(System.in);
- System.out.println("Möchten Sie das Programm wirklich beenden?");
- System.out.println("<1> JA");
- System.out.println("<2> NEIN");
- int abfrage2 = eingabe.nextInt();
- if (abfrage2 == 1) {
- System.exit(0);
- }
- }
- public static void main(String[] args) {
- Scanner eingabe = new Scanner(System.in); //Scanner anlegen
- System.out.println("Bitte loggen Sie sich mit Ihren Nutzerdaten ein:");
- System.out.println("");
- System.out.println("Benutzername:");
- String id = eingabe.next();
- System.out.println("Passwort:");
- String password = eingabe.next();
- int operator;
- boolean weitermachen = true;
- while (weitermachen == true) {
- System.out.println("Was möchten Sie tun?");
- System.out.println("<1> (Vorhandene Dokumente anzeigen)");
- System.out.println("<2> (Dokumente hinzufügen)");
- System.out.println("<3> (Dokumente löschen)");
- System.out.println("<4> (Programm beenden)");
- operator = eingabe.nextInt();
- switch ( (int) operator) {
- case 1:
- anzeigen();
- break;
- case 2:
- hinzufuegen();
- break;
- case 3:
- loeschen();
- break;
- case 4:
- beenden();
- break;
- default:
- System.out.println("Fehlerhafte Eingabe!");
- break;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment