Assignment 2
An extension of Assignment 1. Create a class Dictionary_Part02, which inherits from Dictionary_Part01. In Dictinoary_Part02, implement these additional tasks and add appropriate menu options for them to the menu of the program.
Basic Tasks:
1. List all words that are palindromes. e.g .”civic”
2. Prompt the user for a word, and report all words that are anagrams of the word (e.g. “admirer” and “married”)
Intermediate tasks
3. Override the ‘findWord’ function, so that it produces ‘nicer’ output:
a. The search should not be case sensitive.
b. For words with multiple definitions, each definition should be separated with a line-break – these are represented in the file by a semicolon followed by two spaces.
c. Proper nouns should have their word name capitalised (i.e. the first letter of the word should be a capital).
4. Guessing game – present the definition of a random noun and the length of that noun and ask the user to guess that noun, giving three tries. If the user guesses right, print a congratulatory message. After the first incorrect guess, reveal the first letter of the word, after the second incorrect guess reveal the second letter, after the third guess, print a commiseratory message and print the whole word.
Advanced tasks
5. Fun with Tri-Grams
a. Using a new class, implemented in a separate file, create a class that encapsulates the following functionality: From any given text document (you can use the dictionary), calculate the probability of any character occurring after any combination of two characters (including where the first character is a space, i.e. the start of a word) and store these probabilities. Based on an input of two characters, return the three most likely characters to occur after the two characters. Use the class to generate 10 random words which sound like English words, but do not exist in the dictionary;
Students succeed in their courses by connecting and communicating with an expert until they receive help on their questions
Consult our trusted tutors.