Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DaneOsobowe
- {
- Boolean loggedIn = false;
- String username;
- String password;
- String name;
- String lastName;
- String pesel;
- String address;
- String phoneNumber;
- DaneOsobowe(String username, String password, String name, String lastName, String pesel)
- {
- username = this.username;
- password = this.password;
- name = this.name;
- lastName = this.lastName;
- pesel = this.pesel;
- }
- public void changeData(String username, String password, String name, String lastName, String address, String phoneNumber) throws Exception
- {
- if(username != this.username)
- changeUsername(username);
- if(password != this.password)
- changeUsername(password);
- if(name != this.name)
- changeUsername(name);
- if(lastName != this.lastName)
- changeUsername(lastName);
- if(address != this.address)
- changeUsername(address);
- if(phoneNumber != this.phoneNumber)
- changeUsername(phoneNumber);
- }
- public void changePassword(String newPassword)throws Exception
- {
- if(password.length() < 6)
- throw new Exception ("Hasło musi mieć co najmniej 6 znaków!");
- else
- password = newPassword;
- }
- public void changeUsername(String newUsername)throws Exception
- {
- if(username.length() < 6)
- throw new Exception ("Login musi mieć co najmniej 6 znaków!");
- else
- username = newUsername;
- }
- public void changeName(String newName)throws Exception
- {
- if(name.length() < 3)
- throw new Exception ("Imię musi mieć co najmniej 3 znaki!");
- else
- name = newName;
- }
- public void changeLastName(String newLastName)throws Exception
- {
- if(lastName.length() < 2)
- throw new Exception ("Nazwisko musi mieć co najmniej 3 znaki!");
- else
- lastName = newLastName;
- }
- public void changeAddress(String newAddress)
- {
- address = newAddress;
- }
- public void changePhoneNumber(String newPhoneNumber)
- {
- phoneNumber = newPhoneNumber;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement