Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. Prior to having fancy iPhones, teenagers would wear out their thumbs sending SMS messages on candybar-shaped feature phones with 3x4 numeric keypads.
  2.  
  3. ```
  4. ------- ------- -------
  5. | | | ABC | | DEF |
  6. | 1 | | 2 | | 3 |
  7. ------- ------- -------
  8. ------- ------- -------
  9. | GHI | | JKL | | MNO |
  10. | 4 | | 5 | | 6 |
  11. ------- ------- -------
  12. ------- ------- -------
  13. |PQRS | | TUV | | WXYZ|
  14. | 7 | | 8 | | 9 |
  15. ------- ------- -------
  16. ------- ------- -------
  17. | | |space| | |
  18. | * | | 0 | | # |
  19. ------- ------- -------
  20. ```
  21.  
  22. Prior to the development of T9 (predictive text entry) systems, the method to type words was called "multi-tap" and involved pressing a button repeatedly to cycle through the possible values.
  23.  
  24. For example, to type a letter "R" you would press the 7 key three times (as the screen display for the current character cycles through P->Q->R->S->7). A character is "locked in" once the user presses a different key or pauses for a short period of time (thus, no extra button presses are required beyond what is needed for each letter individually). The zero key handles spaces, with one press of the key producing a space and two presses producing a zero.
  25.  
  26. In order to send the message "WHERE DO U WANT 2 MEET L8R" a teen would have to actually do 47 button presses. No wonder they abbreviated.
  27.  
  28. For this assignment, write a module that can calculate the amount of button presses required for any phrase. Punctuation can be ignored for this exercise. Likewise, you can assume the phone doesn't distinguish between upper/lowercase characters (but you should allow your module to accept input in either for convenience).
  29.  
  30. Hint: While it wouldn't take too long to hard code the amount of keypresses for all 26 letters by hand, try to avoid doing so! (Imagine you work at a phone manufacturer who might be testing out different keyboard layouts, and you want to be able to test new ones rapidly.)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement