From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=BAYES_20,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7ba49aac4e73460,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.135.231 with SMTP id pv7mr41854pbb.8.1328749391324; Wed, 08 Feb 2012 17:03:11 -0800 (PST) Path: wr5ni3088pbc.0!nntp.google.com!news1.google.com!postnews.google.com!j14g2000vba.googlegroups.com!not-for-mail From: Will Newsgroups: comp.lang.ada Subject: Need Help On Ada95 Problem Date: Wed, 8 Feb 2012 17:03:11 -0800 (PST) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 134.240.94.56 Mime-Version: 1.0 X-Trace: posting.google.com 1328749391 23017 127.0.0.1 (9 Feb 2012 01:03:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 9 Feb 2012 01:03:11 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j14g2000vba.googlegroups.com; posting-host=134.240.94.56; posting-account=CZZpzgoAAAAoaHoNNp9zhY9EzQgEmxhU User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALENKRC X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0,gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-02-08T17:03:11-08:00 List-Id: I am new to Ada and need help on an exercise for school. Can anyone help. The problem is as follows ( you can skip all the build up background A Christmas Story references): Problem 1: Secret Decoder Ring You may remember Ralphie's disappointment when he received his Little Orphan Annie Secret Decoder Ring. What you may not realize is that, after Ralphie threw away his ring, his brother Randy dug it out of the trash. Randy grew up to run the IT department of his small hometown bank, and was responsible for storing the 4-digit Personal Identification Numbers (PINs) chosen by his bank's customers. He knew better than to store these PINs in the clear, so he encrypted them using Ralphie's ring. The decoder ring had two wheels, one printed with letters and one printed with numbers. In the video clip, you see Ralphie decoding the numbers read on the radio, looking up each number and copying down the corresponding letter. Randy uses the ring in a similar way, but instead of disguising letters as numbers, he does the reverse, disguising numbers as letters. To encrypt a PIN, he finds each digit on the wheel, and turns it into a letter. (The ring contains some two- digit numbers as well, but he ignores those, using only the single- digit numbers.) Here is a small portion of the decoder ring: number wheel -> 0 1 2 3 4 5 6 7 8 9 letter wheel -> U R O V A L T I N E So, for example, Randy encrypts the PIN 9537 as ELVI. Complete the function Encrypt(PIN) that takes a 4-digit PIN (as a string) and returns the corresponding 4-letter code (also as a string). Note: It would be possible to convert digits to letters using a giant IF statement, but don't do this. Instead, the letter wheel is given to you as a string, so use each digit to read the appropriate letter from the string.