Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Binary Search Tree Traversal and Search Using Iterators In Java/C++ for LA City Database Note: this is an individual project. In this assignment you are
Binary Search Tree Traversal and Search Using Iterators In Java/C++ for LA City Database Note: this is an individual project. In this assignment you are required to implement a binary search tree ADT with insertion and preorder, postorder and inorder traversal operations. The program has one input file called LATowns.txt that contains a LA towns name, latitude, longitude, and population. insert them into the binary search tree. Then it must traverse the tree in preorder, inorder and postorder manner and print the data in the tree on the screen, using the iterators in Java/C++. Note this project can be written in either JAVA or C++. First, please review the two attached files: java_iterator.pdf and c++_iterator.pdf, about how iterators in Java and C++ are implemented. When I execute your program, it firsts read into BSTs the data in LATowns.txt. Then it displays the top menu follows: Welcome to LA City Database 1. Display the information of all the cities (30 pts) 2. Search a city (20 pts) 3. Insert a city (10 pts) 4. Delete a city (10 pts) 5. Update the population of a city (10 pts) 6. Find the distance between two cities (10 pts) 7. Find nearby cities (10 pts) 8. Exit the City Database For 1, it displays the sub menu: 9. Inorder, preorder, and postorder of the cities in terms of their names, 10. Inorder, preorder, and postorder of the cities in the terms of their populations 11. Exit to top menu For 2, it displays the sub menu: 12. Search by Name 13. Search by Population Range 14. Exit to top menu For 12, if it exists, it prints out all of the cities; if not, it prints no such city. For 13, it asks to input the minimum and maximum values of the range, and prints out all the cities whose population fall into that range, along with their population. For 3, it asks to input the city name, population, and its latitude and longitude, if the city already exists, it prints city already exits For 4, it asks to input the city name, it then deletes the city if exists; if not, it prints no such city. For 5, if asks to input the city name; if it exists, it then displays its current information, and asks to input the new information (i.e., population). For 6, it asks to input the names of the two cities, and output the distance in units of kilometers. For 7, it asks to input a citys name and a distance in units of kilometers, it returns the list of cities that are within the distance of the input city. All above should be put in some kind of infinite loop, so that it prompts user for input again and again, until user inputs 8 to exit. In any of the testing, there should be error messages printed out if it takes places. Note: Submission: Please submit your programs in a .zip file named Lastname1_ 521_Proj3.zip. Please do not submit .rar file. It should include all the programs, a readme file about how to compile your programs, if your programs are working, and if so, five to ten screenshots showing the successful execution of your program. You will receive zeros if there is no readme file. LATowns.txt Name Latitute Logitute Population Arcadia 34.109103 -118.017505 12345 Azusa 34.14266 -117.918977 23456 Brentwood 34.046602 -118.485553 74678 Catalina Island 33.340097 -118.329697 12950 Cerritos 33.882809 -118.104757 23445 Lakewood 33.832602 -118.154567 16934 Lancaster 34.671447 -118.122882 98674 Norwalk 33.906109 -118.055455 49589 Palos Verdes 33.757598 -118.388246 34232 Pico Rivera 34.01431 -118.064999 84839 Rio Hondo 33.953599 -118.144547 34553 San Gabriel 34.104506 -118.094853 93848 Santa Anita 34.135556 -118.031506 12321 South Gate 33.944758 -118.182336 1244 Covina 34.054856 -117.887657 58458 Rancho Palos Verdes 33.73907 -118.398194 32145 Carson 33.856677 -118.271328 24454 Valencia 34.40347 -118.584904 58587 Van Nuys 34.190114 -118.490163 94838 San Dimas 34.083231 -117.830588 9877 Long Beach 33.838068 -118.195686 23847 Los Angeles 33.959608 -118.412596 74747 Whittier 33.984036 -118.073998 63643 Rosemead 34.051495 -118.079102 85675 Hacienda Heights 34.02527 -117.989637 85854
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