Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In both Words with friends and the scrabble game, a individual letters in a word are given specific values.
- For this lab, calculate the value of a word with the following specific rules:
- Each letter has the following values:
- A, E, I, M, Q, U, Y are worth 1 point
- B, F, J, N, R, V, Z are worth 2 points
- C, G, K, O, S, W are worth 3 points
- D, H, L, P, T, X are worth 5 points.
- 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.
- Your program should ask the user for a word (without spaces) and print it's value.
- Ignore any special characters or numbers that are entered. [I won't include these in my test cases].
- You HAVE to use my rules or you will receive 0 credit!
- You also need to check to see if the word is in a dictionary. There's one at
- http://www.csit.parkland.edu/~kurban/permanent/lists/
- and it's called web2.txt
- It contains one word per line and is already sorted. You can make your own smaller dictionary to test it if you like.
- Examples:
- asset = (1 + 3 + 3 + 1 + 5) * 2 = 26 (double letters)
- little = (5 + 1 + 5 + 5 + 5 + 1) * 2 = 44 (double letters)
- abacadabra = (1 + 2 + 1 + 3 + 1 + 4 + 1 + 2 + 2 + 1) = 18 (NO double letters)
- 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