Monday's Programming Question
The programming question this week is to decode a book cipher. A book cipher is a way to send a secret message through the use of a specific book text. The code outlines where the words are through their position in the text. For example, if I used this paragraph as a code text I could code the word "secret" as "2-10"; the numbers represent where the word is in terms of sentences and words (i.e., the word "secret" is the tenth word in the second sentence). If I'm even tricker I can use a further two numbers to represent a word within in a word. For instance, "4-7-5-9" is the seventh word in the fourth sentence (i.e., "paragraph") except that it's only part of the word – the fifth letter to the ninth letter (i.e., "graph").
The Java program to write needs to accept a piece of text and then the cipher code. It has to figure out which words within the text are being pointed to by the code and display the coded sentence to the user.
Seeing as it's Christmas I'm going to use a festive quote. It can be found on Simran's best Christmas quote page under Dr. Seuss (i.e., it's about halfway down the page starting with "And the Grinch.."). You can just cut and paste the paragraph as the text input into your program. Can your program figure out the coded question using the following cipher code?
5-7-1-3 8-7-1-3 7-3 3-3 5-9-1-2 4-5-0-3 1-4 2-2-1-2 2-4-0-6 4-6 4-2-1-2 1-13 4-4-0-7


is it Christmas without a box with a ribbon or a puzzling package