Advertisement
Guest User

Untitled

a guest
Jun 1st, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1.  
  2. public class DaneOsobowe
  3. {
  4. Boolean loggedIn = false;
  5. String username;
  6. String password;
  7. String name;
  8. String lastName;
  9. String pesel;
  10. String address;
  11. String phoneNumber;
  12.  
  13. DaneOsobowe(String username, String password, String name, String lastName, String pesel)
  14. {
  15. username = this.username;
  16. password = this.password;
  17. name = this.name;
  18. lastName = this.lastName;
  19. pesel = this.pesel;
  20. }
  21.  
  22. public void changeData(String username, String password, String name, String lastName, String address, String phoneNumber) throws Exception
  23. {
  24. if(username != this.username)
  25. changeUsername(username);
  26. if(password != this.password)
  27. changeUsername(password);
  28. if(name != this.name)
  29. changeUsername(name);
  30. if(lastName != this.lastName)
  31. changeUsername(lastName);
  32. if(address != this.address)
  33. changeUsername(address);
  34. if(phoneNumber != this.phoneNumber)
  35. changeUsername(phoneNumber);
  36.  
  37. }
  38.  
  39. public void changePassword(String newPassword)throws Exception
  40. {
  41. if(password.length() < 6)
  42. throw new Exception ("Hasło musi mieć co najmniej 6 znaków!");
  43. else
  44. password = newPassword;
  45. }
  46. public void changeUsername(String newUsername)throws Exception
  47. {
  48. if(username.length() < 6)
  49. throw new Exception ("Login musi mieć co najmniej 6 znaków!");
  50. else
  51. username = newUsername;
  52. }
  53. public void changeName(String newName)throws Exception
  54. {
  55.  
  56. if(name.length() < 3)
  57. throw new Exception ("Imię musi mieć co najmniej 3 znaki!");
  58. else
  59. name = newName;
  60. }
  61. public void changeLastName(String newLastName)throws Exception
  62. {
  63.  
  64. if(lastName.length() < 2)
  65. throw new Exception ("Nazwisko musi mieć co najmniej 3 znaki!");
  66. else
  67. lastName = newLastName;
  68. }
  69. public void changeAddress(String newAddress)
  70. {
  71. address = newAddress;
  72. }
  73. public void changePhoneNumber(String newPhoneNumber)
  74. {
  75. phoneNumber = newPhoneNumber;
  76. }
  77.  
  78.  
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement