Implementing Hash Table with Chaining for Phone Number Word-Based Representation
Added on -2019-09-16
Implementing hash table with chaining for phone number word-based representation in Python. Program asks user to enter a phone number and prints out the word-based representation if exist otherwise it will indicate that there is no meaningful word-based representation of the given number.
| 4 pages
| 1007 words
| 447 views
Trusted by 2+ million users, 1000+ happy students everyday
Assignment 2 Due at 11:00 AM on November 22, 2016(100 pts)Objective: You will implement hash table with chaining.The international standard letter/number mapping found on the telephone is shown below:Using these characters on the key-pad, we can come up with word-based representation of aphone number so that it would be easy to remember. For example, 1-800-AAA-HELP. This isvery much easy to remember than 1-800-222-4357. It is obvious that some phone numberscannot be turned into word-based representation. For example if the number has 1 or 0,then there is no corresponding characters on the key-pad. Some time we may not findmeaningful word to represent the given number even if it does not contain 0 or 1. In thisproject, you will write a program that will ask user to enter a phone number (10-digitexcluding leading 1) and will print out the word-based representation if exist otherwise it willindicate that there is no meaningful word-based representation of the given number and justprint out the given number in the following form: 1-area-exchange-number. A typical phone number has three components:1)area(three digit) 2)exchange(three digit)3)number(four digit)As you have seen in the example above, if one wants to find out the word-basedrepresentation of a given phone number, he/she will find the word based representation of
exchange and number i.e. last 7-digit of the given phone number. There are severalpossibilities here:1)If there is only word-based representation of whole 7 digits2)Else If there is only word-based representation of exchange (3 digit) and number (4digit)3)Else If there is word-based representation of only exchange (3 digit)4)Else If there is word-based representation of only number (4 digit)5)Else there is no word-based representation given number.Hence your program should do the following:1)If there exist 10-digit word-based exist, then print it (or all if more than one).2)If there exist 7-digit excluding area code, then print out it (or all if more than one).3)If 7 and 10 are not possible, then print 3-digit followed 4-digit form. Again print allpossibilities.4)If step 1, 2, and 3 are not possible, then print only the exchange in a word-basedform.5)If step 1, 2, 3, and 4 are not possible, then print only the number in word-based form.6)If none is possible, then print the number in 1-area-exchange-number form.Examples:1)Given number is 2266762559, then your output should be:1-ABNORMALLY2)If the given number is 2702637422, then your output should be:1-270-AMERICA.3)If the given number is 6157862243, then your program should print out the followingnumbers:1-615-RUN-ACHE1-615-RUN-ACIDThere is no meaningful word for 7862243. So we look at the words for 786 and 2243. These are RUN, SUM, SUM and ACHE, ACID, CAGE. The all possible are listed as above.4)If the given number is 1939292244, then it returns/lists the following phone number:1-193-WAX-22441-193-WAY-22445)If the given number is 18003218428, then it returns/lists the following phone number1-800-321-THAT6)If the given number is 18002002244, then it returns/lists the following phone number1-800-200-2244
Found this document preview useful?
You are reading a preview Upload your documents to download or Become a Desklib member to get accesss