comp.lang.ada
 help / color / mirror / Atom feed
From: "Alex" <alex@foo.invalid>
Subject: Re: Need Help On Ada95 Problem
Date: Thu, 9 Feb 2012 03:38:17 +0000 (UTC)
Date: 2012-02-09T03:38:17+00:00	[thread overview]
Message-ID: <jgvf39$bhe$1@dont-email.me> (raw)
In-Reply-To: a5adb33b-96ba-4f48-adfa-9a01e1d42a7d@j14g2000vba.googlegroups.com

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.



  parent reply	other threads:[~2012-02-09  3:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-09  1:03 Need Help On Ada95 Problem Will
2012-02-09  1:51 ` Robert A Duff
2012-02-09  2:01 ` Shark8
2012-02-10  1:36   ` BrianG
2012-02-10  2:22     ` Shark8
2012-02-10  5:32       ` Alex
2012-02-10 15:19         ` Shark8
2012-02-10 15:45           ` Alex
2012-02-10 20:07           ` Robert A Duff
2012-02-12 19:40             ` Will
2012-02-12 19:42               ` Will
2012-02-12 22:26               ` Robert A Duff
2012-02-13  0:41                 ` Will
2012-02-13  0:43                 ` Nasser M. Abbasi
2012-02-10  5:45       ` Alex
2012-02-10 13:29         ` Robert A Duff
2012-02-10 13:50           ` Alex
2012-02-10 14:30             ` Robert A Duff
2012-02-10 15:32               ` Alex
2012-02-10 20:03                 ` Robert A Duff
2012-02-13  3:28       ` BrianG
2012-02-10  8:47   ` Simon Wright
2012-02-09  3:38 ` Alex [this message]
     [not found]   ` <90a10801-440b-4a31-88d0-f0f7c17137f1@eb6g2000vbb.googlegroups.com>
2012-02-09 13:35     ` Alex
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox