Using the ElementDatabase.cpp file given below, create a database of chemical elements (elements from the periodic table). The program interface should match the example below. File -
#include using namespace std; struct Element { int atomicNumber; string symbol; string name; Element *left; Element *right; }; class ElementDatabase{ private: Element* root; void addElement(Element *&e, int atomicNumber, string symbol, string name){ } void printElements(Element *e){ } // Returns the address of the element if a match is found // Return NULL if no match is found Element* findElementBySymbol(Element *e, string symbol){ return NULL; } // Returns the address of the element if a match is found // Return NULL if no match is found Element* findElementByName(Element *e, string name){ return NULL; } void deleteElement(Element *&e, int atomicNumber){ } public: ElementDatabase(){ root = NULL; } void addElement(int atomicNumber, string symbol, string name){ addElement(root, atomicNumber, symbol, name); } void printElements(){ printElements(root); } // Returns the address of the element if a match is found // Return NULL if no match is found Element* findElementBySymbol(string symbol){ return findElementBySymbol(root, symbol); } // Returns the address of the element if a match is found // Return NULL if no match is found Element* findElementByName(string name){ return findElementByName(root,name); } void deleteElement(int atomicNumber){ deleteElement(root,atomicNumber); } }; int main(){ // Complete the functions above // Add more functions if necessary // Create the menu as shown in the example of program execution // The program should only exit when the user chooses "Exit program" } Example - ----------------------------- 1. Add an element 2. View elements 3. Search elements by chemical symbol 4. Search elements by element name 5. Delete an element 6. Exit program Enter your choice: 1 ** Add an element ** Enter atomic number: 3 Enter chemical symbol: Li Enter element name: Lithium Element added successfully. ----------------------------- 1. Add an element 2. View elements 3. Search elements by chemical symbol 4. Search elements by element name 5. Delete an element 6. Exit program Enter your choice: 1 ** Add an element ** Enter atomic number: 36 Enter chemical symbol: Kr Enter element name: Krypton Element added successfully. ----------------------------- 1. Add an element 2. View elements 3. Search elements by chemical symbol 4. Search elements by element name 5. Delete an element 6. Exit program Enter your choice: 1 ** Add an element ** Enter atomic number: 2 Enter chemical symbol: He Enter element name: Helium Element added successfully. ----------------------------- 1. Add an element 2. View elements 3. Search elements by chemical symbol 4. Search elements by element name 5. Delete an element 6. Exit program Enter your choice: 2 ** View Elements ** 2, He, Helium 3, Li, Lithium 36, Kr, Krypton ----------------------------- 1. Add an element 2. View elements 3. Search elements by chemical symbol 4. Search elements by element name 5. Delete an element 6. Exit program Enter your choice: 3 ** Search Elements by Chemical Symbol ** Enter chemical symbol: Li Search result: 3, Li, Lithium ----------------------------- 1. Add an element 2. View elements 3. Search elements by chemical symbol 4. Search elements by element name 5. Delete an element 6. Exit program Enter your choice: 3 ** Search Elements by Chemical Symbol ** Enter chemical symbol: Co Search result: No element was found. ----------------------------- 1. Add an element 2. View elements 3. Search elements by chemical symbol 4. Search elements by element name 5. Delete an element 6. Exit program Enter your choice: 4 ** Search Elements by Element Name ** Enter chemical symbol: lithium Search result: 3, Li, Lithium ----------------------------- 1. Add an element 2. View elements 3. Search elements by chemical symbol 4. Search elements by element name 5. Delete an element 6. Exit program Enter your choice: 4 ** Search Elements by Element Name ** Enter element name: HELIUM Search result: 2, He, Helium ----------------------------- 1. Add an element 2. View elements 3. Search elements by chemical symbol 4. Search elements by element name 5. Delete an element 6. Exit program Enter your choice: 4 ** Search Elements by Element Name ** Enter element name: Oxygen Search result: No element was found. ----------------------------- 1. Add an element 2. View elements 3. Search elements by chemical symbol 4. Search elements by element name 5. Delete an element 6. Exit program Enter your choice: 5 ** Delete an element ** Enter atmoic number: 2 Do you want to delete: 2, He, Helium Enter y or n:y Element deleted successfully. ----------------------------- 1. Add an element 2. View elements 3. Search elements by chemical symbol 4. Search elements by element name 5. Delete an element 6. Exit program Enter your choice: 5 ** Delete an element ** Enter atmoic number: 5 No element was found. ----------------------------- 1. Add an element 2. View elements 3. Search elements by chemical symbol 4. Search elements by element name 5. Delete an element 6. Exit program Enter your choice: 2 ** View Elements ** 3, Li, Lithium 36, Kr, Krypton ----------------------------- 1. Add an element 2. View elements 3. Search elements by chemical symbol 4. Search elements by element name 5. Delete an element 6. Exit program Enter your choice: 6 Program has exited.. Provide a single cpp file. The database must be implemented using Binary Search Tree data structure. Use the atomic number as the key (to decide which element will got left or right in the tree). *Search by name should work for uppercase and lowercase letters.