Write a program in C++ language that implements an English Dictionary using Doubly Linked List and OOP concepts. This as

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write a program in C++ language that implements an English Dictionary using Doubly Linked List and OOP concepts. This as

Post by answerhappygod »

Write a program in C++ language that implements an
English Dictionary using Doubly Linked List and OOP
concepts.
This assignment has five parts:
1- Write a class(new type) to define the Entry type that will
hold the word and its definition.
2- Define the Map or Dictionary ADT using the interface in
C++.
3- Implement the interface defined on point 2 using Doubly
Linked List, which will operate with Entry type. Name this class as
NodeDictionaryG.
4- Implement the EnglishDictionary class.
5- Test it in the main function
All Constructors should use the initializer list.
1. 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 <string,
string>.
Member variables:
* K_key; //English word (key)
* V_Value; //word definition (value)
Member functions:
* Entry(K, V);
* virtual ~Entry();
* K getK();
* V getV();
* void setK(K);
* void setV(V);
2. Define the Map or Dictionary ADT using the interface
in C++, the interface should be designed to hold any
type.
Note: if you define Map ADT you should add the extra operations
that Dictionary ADT has during the implementation of the Map
interface.
3. Implement the interface defined on point 2 using
Doubly Linked List.
NodeDictionaryG class
Member variables:
* int uniqueKeys; // the current number of unique
keys in Dictionary
* int size // the total number of entries
* DNodeG<K,V>* header; //
head-of-list-sentinel
* DNodeG<K,V>* trailer //
tail-of-list-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<K,V> begin() const; // beginning
position
* IteratorG end() const; // (just beyond) last
position
* IteratorG find(K) const; // find entry with
key k, returns an iterator that points to the first
* IteratorG put(K, V); // insert pair
(k,v)
* void erase(K& k); // remove the first
entry with key k
* void erase(IteratorG); // erase entry at
Iterator
* void erase(Range); // erase entry at
range
* Range findAll(K); //returns the range for a
key
* void print(bool); //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 print(Range); //prints all Entries in
range
4. Implement the EnglishDictionary class using
the NodeDictionaryG class operations. The EnglishDictionary 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 add(Entry) // adds a word with its
definition in the dictionary
* void deleteFirst(string) // removes the
first word equal to a given string
* void delete(string) // removes from
dictionary all the words equal to a given string
* void printDictionary(bool) //prints all
words and definitions. If bool is true print from the beginning,
else print them from the end of the dictionary.
* void printDictionary (string) //prints the
definitions for a given word
* Entry find(string) // returns the first word
and its definition equal to a given string
5. Test it in the main function
Create an English Dictionary with 10 words and their
definitions, with word repetition as {3 definitions, 4 definitions,
1 definition, 2 definitions). Print the list of all words and
definitions. Remove the first definition from the word that has 3
definitions. Search for the word that has 4 definitions and print
them all. Remove the first definition from the word that has 4
definitions. Remove all the definitions from the word that has 2
definitions (you have to words that has 2 definitions remove both
of them). Print the list of all words and definitions.
!!! PLEASE MAKE SURE THE PROGRAM WORKS PROPERLY. PREFERABLY IN
VISUAL STUDIO !!!
Write A Program In C Language That Implements An English Dictionary Using Doubly Linked List And Oop Concepts This As 1
Write A Program In C Language That Implements An English Dictionary Using Doubly Linked List And Oop Concepts This As 1 (155.29 KiB) Viewed 40 times
Write A Program In C Language That Implements An English Dictionary Using Doubly Linked List And Oop Concepts This As 2
Write A Program In C Language That Implements An English Dictionary Using Doubly Linked List And Oop Concepts This As 2 (178.43 KiB) Viewed 40 times
Write A Program In C Language That Implements An English Dictionary Using Doubly Linked List And Oop Concepts This As 3
Write A Program In C Language That Implements An English Dictionary Using Doubly Linked List And Oop Concepts This As 3 (167.58 KiB) Viewed 40 times
Write a program in C++ language that implements an English Dictionary using Doubly Linked List and OOP concepts. This assignment has five parts: 1. Write a class(new type) to define the entry type that will hold the word and its definition. 2- Define the Map or Dictionary ADT using the interface in C++. 3- Implement the interface defined on point 2 using Doubly Linked List, which will operate with Entry type. Name this class as NodeDictionary. 4- Implement the English Dictioanry class. 5- Test it in the main function All Constructors should use the initializer list. 1. 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 <string, string> Member variables: • K_key://English word (key) • V_value;//word definition (value) Member functions: • Entry(K, V); • virtual Entry (); • K getk 0); • V get(); • void setk(K); • void setv(V); 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? 2. 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 11 (Map ADT) and lesson 12 (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. 3. Implement the interface defined on point 2 using Doubly Linked List. You can find the C++ header file in lesson 12. 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<K,V>* header; // head-of-list sentinel • DNodeG<K,V>* trailer; // tail-of-list 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<K,V> begin() const; // beginning position • IteratorG<K,V> end() const; // (just beyond) last position • IteratorG<K,V> find(K) const; // find entry with key k, returns an iterator that points to the first • IteratorG<K,V>put(K, V); // insert pair (k,v) • void erase(K& k); // remove the first entry with key k • void erase(IteratorG<K,V>); // erase entry at Iterator • void erase(Range<K,V>); // erase entry at range • Range<K,V> findAll(K); //returns the range for a key • void print(bool); //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 print(Range<K,V>); //prints all Entries in range Answer questions below before implementing NodeDictionary 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 Iterator class is defined in lesson 7. The Range type is the type defined in lesson 12. 4. Implement the English Dictioanry class using the NodeDictionary class operations. The English Dictioanry class should have at least the following functions and member variables: English Dictionary 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 English Dictionary (); • int words() const; // number of words in dictionary • int unique Words() const; // number of unique words in dictionary • bool empty() const; // is the dictionary empty • void add(Entry<string, string>) // adds a word with its definition in the dictionary • void delete First(string) // removes the first word equal to a given string void delete(string) // removes from dictionary all the words equal to a given string • void printDictionary(bool) //prints all words and definitions. If bool is true print from the beginning, else print them from the end of the dictionary. • void printDictionary (string) //prints the definitions for a given word • Entry<string,string> find(string) // returns the first word and its definition equal to a given string Answer questions below before implementing English Dictionary 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. 5. Test it in the main function Create e English Dictionary with 10 words and their definitions, with word repetition as {3 definitions, 4 definitions, 1 definition, 2 definitions). Print the list of all words and definitions. Remove the first definition from the word that has 3 definitions. Search for the word that has 4 definitions and print them all. Remove the first definition from the word that has 4 definitions. Remove all the definitions from the word that has 2 definitions (you have to words that has 2 definitions remove both of them). Print the list of all words and definitions.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply