Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class User {
- private String userName;
- private String password;
- private boolean admin;
- public User(String userName, String password , boolean admin) {
- this.userName = userName;
- this.password = password;
- this.admin = admin;
- }
- public String getUserName() {
- if (isAdmin(userName,password) && admin == true) {
- return userName;
- }
- return "Access Denied!";
- }
- public void setFirstName(String userName) {
- if (isAdmin(userName,password) && admin == true){
- this.userName = userName;
- }
- }
- public String getPassword() {
- if (isAdmin(userName,password)&& admin == true) {
- return password;
- }
- return "Access Denied!";
- }
- public void setPassword(String password) {
- if (isAdmin(userName,password)&& admin == true) {
- }
- this.password = password;
- }
- public boolean isAdmin(String userName, String password){
- return admin;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement