0 = none 1 = none 2 = ABC 3 = DEF 4 = GHI 5 = JKL 6 = MNO 7

advertisement
CIS265
Due: Tue. Wed. Sept. 24th
Homework 2
Telephone keypads based on the ITU E 1.161 International Standard offer a set of letters on top of each
numeric key as indicated below
0 = none
1 = none
2 = ABC
3 = DEF
4 = GHI
5 = JKL
6 = MNO
7 = PQRS
8 = TUV
9 = WXYZ
A ‘PHONETIC’ phone number could be expressed as a combination of numbers and digits (obviously
some combinations are ‘better’ than others). The following table shows some examples of phonetic
phones and their corresponding numeric expressions.
Phonetic Phone Number
1800RENTACAR
Numeric Phone Number
180073682227
1800FLOWERS
18003569377
BEHAPPY
2342779
Write a Java program to convert a phonetic phone number to a digits only phone number. Test the
program with the three samples given above.
HINT:
Scan phonetic phone string, one character at the time. Replace each letter with its corresponding digit.
Read the course’s syllabus for specs on how to prepare your homework report.
Download