Use a switch statement instead of a bunch of if-else checks and pull out the common...