Google Question
Most people have adopted the decimal number system which has ten symbols (0,1,2,3,4,5,6,7,8,9). There are other number systems like binary, hex and octal. Your job is to convert a hex number into a musical number. What is a musical number you might ask? It’s something we invented. Keep reading.
The Hex alphabet contains 16 symbols: 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f
The Musical alphabet contains 12 symbols: A,A#,B,C,C#,D,D#,E,F,F#,G,G# (# is pronounced 'sharp' so 'A#' is pronounced 'A-sharp', 'C#' is 'C-sharp' and so on)
Your program should validate input (make sure input is a hex number i.e. it is in base-16) and convert it to a number represented by the musical alphabet (base-12). Your program should output the musical number OR an error string "Input is not valid Hex" if the input is not valid hex
Trying to pass off an idiotic homework question as a Google question?
- Anonymous December 04, 2013