Advertisement
Guest User

registrazione

a guest
Oct 17th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. public class Registrazione {
  2. private String nome;
  3. private String cognome;
  4. private String sesso;
  5. private String email;
  6. private String password;
  7.  
  8. public Registrazione() {
  9. this.cognome=null;
  10. this.nome=null;
  11. this.password=null;
  12. this.sesso=null;
  13. this.password=null;
  14. }
  15.  
  16. public String getNome() {
  17. return nome;
  18. }
  19. public void setNome(String nome) {
  20. this.nome = nome;
  21. }
  22.  
  23. public void controlloNome() throws IllegalArgumentException {
  24. if(nome.length()==0)
  25. throw new IllegalArgumentException("Nome troppo breve");
  26. if(nome.length()>20)
  27. throw new IllegalArgumentException("Cognome troppo breve");
  28. }
  29.  
  30. public String getCognome() {
  31. return cognome;
  32. }
  33. public void setCognome(String cognome) {
  34. this.cognome = cognome;
  35. }
  36.  
  37. public void controlloCognome() throws IllegalArgumentException{
  38. if(cognome.length()==0)
  39. throw new IllegalArgumentException("Cognome troppo breve");
  40. if(cognome.length()>20)
  41. throw new IllegalArgumentException("Cognome troppo lungo");
  42. }
  43. public String getSesso() {
  44. return sesso;
  45. }
  46. public void setSesso(String sesso) {
  47. this.sesso = sesso;
  48. }
  49.  
  50. public String getEmail() {
  51. return email;
  52. }
  53. public void setEmail(String email) {
  54. this.email = email;
  55. }
  56. public String getPassword() {
  57. return password;
  58. }
  59. public void setPassword(String password) {
  60. this.password = password;
  61. }
  62.  
  63. public void controlloPassword() throws IllegalArgumentException{
  64. if(password.length()==0)
  65. throw new IllegalArgumentException("Password troppo breve");
  66. if( password.length()>20)
  67. throw new IllegalArgumentException("Password troppo lunga");
  68. }
  69.  
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement