Advertisement
Guest User

Untitled

a guest
Jul 28th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. In both Words with friends and the scrabble game, a individual letters in a word are given specific values.
  2.  
  3. For this lab, calculate the value of a word with the following specific rules:
  4. Each letter has the following values:
  5. A, E, I, M, Q, U, Y are worth 1 point
  6. B, F, J, N, R, V, Z are worth 2 points
  7. C, G, K, O, S, W are worth 3 points
  8. D, H, L, P, T, X are worth 5 points.
  9. Any word that contains two (or more) of the same letter in a row has it's value doubled. Some examples are 'asset' and 'little'. You can only double things once.
  10. Your program should ask the user for a word (without spaces) and print it's value.
  11. Ignore any special characters or numbers that are entered. [I won't include these in my test cases].
  12. You HAVE to use my rules or you will receive 0 credit!
  13.  
  14. You also need to check to see if the word is in a dictionary. There's one at
  15.  
  16. http://www.csit.parkland.edu/~kurban/permanent/lists/
  17.  
  18. and it's called web2.txt
  19.  
  20. It contains one word per line and is already sorted. You can make your own smaller dictionary to test it if you like.
  21.  
  22. Examples:
  23.  
  24. asset = (1 + 3 + 3 + 1 + 5) * 2 = 26 (double letters)
  25.  
  26. little = (5 + 1 + 5 + 5 + 5 + 1) * 2 = 44 (double letters)
  27.  
  28. abacadabra = (1 + 2 + 1 + 3 + 1 + 4 + 1 + 2 + 2 + 1) = 18 (NO double letters)
  29.  
  30. football = (2 + 3 + 3 + 5 + 2 + 1 + 5 + 5) * 2 = 52 (double letters only double once)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement