Advertisement
Guest User

Untitled

a guest
Mar 12th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. package main;
  2.  
  3. import java.io.FileNotFoundException;
  4. import java.util.Scanner;
  5.  
  6. public class JestProgress {
  7. public static int menu() {
  8. System.out.println(" ****************************************");
  9. System.out.println(" * JEST PROGRESS *");
  10. System.out.println(" ****************************************");
  11. System.out.println("1. Nowy Uzytkownik");
  12. System.out.println("2. Wyswietl dane");
  13. System.out.println("3. Zaloguj sie");
  14. System.out.println("0. Wyjscie");
  15.  
  16. Scanner in = new Scanner(System.in);
  17. int w = in.nextInt();
  18. return w;
  19. }
  20.  
  21. public static void main(String[] args) throws FileNotFoundException {
  22. int choice = menu();
  23. while (choice != 0) {
  24. Scanner in = new Scanner(System.in);
  25. switch (choice) {
  26. case 1:
  27. User newuser = new User();
  28. newuser.userdata();
  29. break;
  30. case 2:
  31. ControlPanel.show();
  32. break;
  33. case 3:
  34. String login1;
  35. int password1;
  36. System.out.print("Podaj login:");
  37. login1 = in.next();
  38. System.out.print("Podaj haslo:");
  39. password1 = in.nextInt();
  40. User user = getUser(login1);
  41. if (user!=null && user.password== password1) {
  42. System.out.println("Zalogowales sie poprawnie.");
  43. }
  44. else {
  45. System.out.println("Niepoprawny login lub haslo, sprobuj ponownie.");
  46. }
  47. }
  48. choice = menu();
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement