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=-0.0 required=5.0 tests=BAYES_20 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7ba49aac4e73460 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.222.71 with SMTP id qk7mr288042pbc.1.1328758698682; Wed, 08 Feb 2012 19:38:18 -0800 (PST) Path: wr5ni3478pbc.0!nntp.google.com!news2.google.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: "Alex" Newsgroups: comp.lang.ada Subject: Re: Need Help On Ada95 Problem Date: Thu, 9 Feb 2012 03:38:17 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Injection-Date: Thu, 9 Feb 2012 03:38:17 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="idyNQtORD/zz+8SMt6pqMA"; logging-data="11822"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+HihdAm6nzrQp3pvVrzevPU5VcpS3aoGc=" User-Agent: XanaNews/1.19.1.320 Cancel-Lock: sha1:AYOuEBuELG8GZCUE8efh2sr0FN0= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Date: 2012-02-09T03:38:17+00:00 List-Id: Will, My first tip to you is to remember that Ada strings are simply arrays of characters, each character of which can be individually accessed by a number representing its location in the string. You might look at pages 430 and 431 of Feldman, if that's your text book. My second tip is to remember to document all help received in accordance with DWW. Good luck! Will wrote: > 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.