Skip to content

Instantly share code, notes, and snippets.

@abner-math
Created February 1, 2020 16:55
Show Gist options
  • Save abner-math/2b6882afa66ec2eb9c32d75855815036 to your computer and use it in GitHub Desktop.
Save abner-math/2b6882afa66ec2eb9c32d75855815036 to your computer and use it in GitHub Desktop.
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