In the early days of computer graphics, colors where represented as two numbers. The first number was the foreground color and the second was the background color. These two values, which ranged from 0 to 15 were stored within a single byte; the foreground color being the upper four bits and the background color being the lower four bits.
Write a program that will ask a user if they wish to encode or decode a color combination. For the encoding, the user can only enter values between 0 and 15 for either the foreground or background color, and then the program will display the numerical value obtained when the foreground color is placed in the upper four bits and the background color is placed in the lower four bits.
For decoding, the user will enter a number between 0 and 255 (the maximum value for 8 bits), and the program will print out the numbers for the foreground and background colors.