Guest User

Untitled

a guest
Apr 23rd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. // Blatt 5 Gruppe JP0147 Martin Kozialkowski, Marcel Weber
  2. import java.util.Scanner;
  3. public class Hausaufgabe6 {
  4.  
  5. public static void anzeigen() {
  6. System.out.println("Diese Funktion steht noch nicht zur Verfügung!");
  7. }
  8.  
  9. public static void hinzufuegen() {
  10. // <<Dokumente hinzufügen>>
  11. }
  12. public static void loeschen() {
  13. Scanner eingabe = new Scanner(System.in);
  14. //<<Suche Datei aus>>
  15. System.out.println("Möchten Sie die Datei wirklich löschen?");
  16. System.out.println("<1> JA");
  17. System.out.println("<2> NEIN");
  18. int abfrage = eingabe.nextInt();
  19. /* if (abfrage == 1) {
  20. * // <<Lösche die Datei>>
  21. * } else {
  22. * weitermachen = true;
  23. * }
  24. */
  25. }
  26.  
  27. public static void beenden() {
  28. Scanner eingabe = new Scanner(System.in);
  29. System.out.println("Möchten Sie das Programm wirklich beenden?");
  30. System.out.println("<1> JA");
  31. System.out.println("<2> NEIN");
  32. int abfrage2 = eingabe.nextInt();
  33. if (abfrage2 == 1) {
  34. System.exit(0);
  35. }
  36. }
  37.  
  38. public static void main(String[] args) {
  39. Scanner eingabe = new Scanner(System.in); //Scanner anlegen
  40.  
  41. System.out.println("Bitte loggen Sie sich mit Ihren Nutzerdaten ein:");
  42. System.out.println("");
  43. System.out.println("Benutzername:");
  44. String id = eingabe.next();
  45. System.out.println("Passwort:");
  46. String password = eingabe.next();
  47. int operator;
  48. boolean weitermachen = true;
  49. while (weitermachen == true) {
  50. System.out.println("Was möchten Sie tun?");
  51. System.out.println("<1> (Vorhandene Dokumente anzeigen)");
  52. System.out.println("<2> (Dokumente hinzufügen)");
  53. System.out.println("<3> (Dokumente löschen)");
  54. System.out.println("<4> (Programm beenden)");
  55. operator = eingabe.nextInt();
  56. switch ( (int) operator) {
  57. case 1:
  58. anzeigen();
  59. break;
  60.  
  61. case 2:
  62. hinzufuegen();
  63. break;
  64.  
  65. case 3:
  66. loeschen();
  67. break;
  68.  
  69. case 4:
  70. beenden();
  71. break;
  72.  
  73. default:
  74. System.out.println("Fehlerhafte Eingabe!");
  75. break;
  76. }
  77. }
  78. }
  79. }
Add Comment
Please, Sign In to add comment