Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
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 -
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | #include |
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..
Submit a single .cpp file.
The database must be implemented using a Binary Search Tree data structure. Use the atomic number as the key (to decide which element will get left or right in the tree).
*Search by name should work for uppercase and lowercase letters.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started