Binary Search Tree Traversal and Search Using Iterators In Java for City Database

  • Job DurationLess than a week
  • Project LevelBasic Level
  • Project deadlineExpired

Project detail

I need 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 town’s 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.
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
2. Search a city
3. Insert a city
4. Delete a city
5. Update the population of a city
6. Find the distance between two cities
7. Find nearby cities
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 city’s 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.

Please also include:
• how to compile your programs,
• Also detain of a program and a readme file

Skills Required

Industry Categories

Freelancer type required for this project