Question: Write a program in C + + language that implements an English Dictionary using Doubly Linked List and OOP concepts. This assignment has five parts:
Write a program in C language that implements an English Dictionary using Doubly Linked List and OOP concepts. This assignment has five parts:
Write a classnew type to define the Entry type that will hold the word and its definition.
Define the Map or Dictionary ADT using the interface in C
Implement the interface defined on point using Doubly Linked List, which will operate with Entry type. Name this class as NodeDictionaryG.
Implement the EnglishDictioanry class.
Test it in the main function All Constructors should use the initializer list.
Entry class The class should be designed in such a way that can hold any type. In this implementation we will use it to hold
Member variables:
K key;English word key
V value;word definition value
Member functions:
EntryK V;
virtual ~ Entry ;
K getK ;
V getV ;
void setKK;
void setVV;
Answer questions below before implementing class Entry: Which methods should be public and which ones can be private? Should data members be public or private? Define the Map or Dictionary ADT using the interface in C the interface should be designed to hold any type. You can find the list of operations in lesson Map ADT and lesson Dictionary ADT posted on the blackboard. Note: if you define Map ADT you should add the extra operations that Dictionary ADT has during the implementation of the Map interface.
Implement the interface defined on point using Doubly Linked List. You can find the C header file in lesson You have to make additional implementations as required for new types.
NodeDictionaryG
class Member variables:
int uniqueKeys; the current number of unique keys in Dictionary
int size the total number of entries
DNodeG header; headoflist sentinel
DNodeG trailer; tailoflist sentinel Member functions:
NodeDictionaryG ;
virtual ~ NodeDictionaryG ;
int size const; returns the number of nodes
int uniqueKeys const; returns the current number of unique keys in Dictionary
bool empty const; is the list empty
IteratorG begin const; beginning position
IteratorG end const; just beyond last position
IteratorG findK const; find entry with key k returns an iterator that points to the first
IteratorG putK V; insert pair kv
void eraseK& k; remove the first entry with key k
void eraseIteratorG; erase entry at Iterator
void eraseRange; erase entry at range
Range findAllK; returns the range for a key
void printbool; prints all Entries that are in the list, starting from the header to the trailer if bool param is true and reverse order is bool parameter is false this function should be designed as a recursive function
void printRange; prints all Entries in range
Answer questions below before implementing NodeDictionaryG class: Which methods should be public and which ones should be private? Should data members be public or private? Should we create getters and setters methods for member variables? For which member makes sense to implement them? Implement them. Note: The IteratorG class is defined in lesson The Range type is the type defined in lesson
Implement the EnglishDictioanry class using the NodeDictionaryG class operations. The EnglishDictioanry class should have at least the following functions and member variables:
EnglishDictionary
class Member variables:
string name; will hold the name of the English dictionary
NodeDictionaryG dictionary; will hold the words and their definitions Member functions:
EnglishDictionary string;
virtual ~ EnglishDictionary ;
int words const; number of words in dictionary
int uniqueWords const; number of unique words in dictionary
bool empty const; is the dictionary empty
void addEntry adds a word with its definition in the dictionary
void deleteFirststring removes the first word equal to a given string
void deletestring removes from dictionary all the words equal to a given string
void printDictionaryboolprints all words and definitions. If bool is true print from the beginning, else print them from the end of the dictionary.
void printDictionary stringprints the definitions for a given word
Entry findstring returns the first word and its definition equal to a given string
Answer questions below before implementing EnglishDictionary class: Which methods should be public and which ones should be private? Should data members be public or private? Should we create getters and setters methods for member variables? For which member makes sense to implement them? Implement them.
Test it in the main function
Create e English Dictionary with words and their definitions, with word repeti
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
