Created
February 1, 2020 16:55
-
-
Save abner-math/2b6882afa66ec2eb9c32d75855815036 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Developer { | |
private Role role; | |
public double getSalary() { | |
switch(this.role) { | |
case TRAINEE: | |
return 500; | |
case JUNIOR: | |
return 1000; | |
case EXPERT: | |
return 2000; | |
case SENIOR: | |
return 4000; | |
default: | |
throw new RoleException("Invalid role."); | |
} | |
} | |
public boolean promote() { | |
switch(this.role) { | |
case TRAINEE: | |
this.role = Role.JUNIOR; | |
break; | |
case JUNIOR: | |
this.role = Role.EXPERT; | |
break; | |
case EXPERT: | |
this.role = Role.SENIOR; | |
break; | |
default: | |
return false; | |
} | |
return true; | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment