(Latest Revision: 09/30/2014)

SECOND CS 1500 SOLO PROGRAM: Translating Phone Letters To Digits

It can be helpful to get a phone number in a format like this:
Just call 1-800-FLOWERS
It's probably easy to remember that. However, when the time comes to dial the number, it may slow a person down, having to hunt for which phone digits correspond to F, L, O, W, E, R, and S.

Your assignment is to write a program whose purpose is to input a single upper-case letter, and to output the corresponding phone digit.

Here is a table that tells what digit corresponds to each upper-case letter:
ABC ==> 2      DEF ==> 3      GHI ==> 4      JKL ==> 5
MNO ==> 6      PRS ==> 7      TUV ==> 8      WXY ==> 9
(Did you notice that it's an old phone? It has no Q or Z.) The program has to print specific information, handle certain errors in a specific way, and give its results using a certain format. Refer to this script to figure out all the details regarding what the output should be when you run your progam.

Make sure to write the program so that it inputs only one character. When I test the programs of all the students in the class, I will need to use special techniques (a script that utilizes redirection from prepared files of input). In effect, another program will test your program, and the programs of all your classmates. This requires that all the programs behave exactly the same way, especially when they read input.

TESTING AND CORRECTNESS:

Your program will lose significant credit if it doesn't work correctly on all possible inputs. Your script must show that you tested for all of the types of errors that the program is supposed to catch. (Read the sample script so you understand what all those types of errors are.) Also, your script must show that you tested enough upper-case letters to get all these digits as outputs: (2, 3, 4, 5, 6, 7, 8, and 9). My procedures will test your program exhaustively.

DESIGN DETAILS:

For the character that your program inputs, use a char variable.

Use C++ if-else-logic or C++ if-logic to program the decisions that determine what output statements the program writes in response to the character the user inputs. No switch statements are allowed. Read the appropriate sections of your text book to learn about if-else-logic and if-logic. Come to class to see discussion of this kind of C++ programming.


WHAT TO TURN IN:

You will be sending me two e-mail messages. Please follow these rules: Here is the list of things that you have to turn in: Note that there are no spaces in the subject lines given. It is important that you do not insert any spaces. My e-mail address is:

john@ishi.csustan.edu



WHEN IS THIS ASSIGNMENT DUE?

Look for the due date in the class schedule. (It's at the top level of the class directory.)