Project 3-3: Earthquake Data Application

In the last part of this project, you will use the BST ADT from part 2 towards an application that utilizes earthquake data. US Geological Survey (USGL) publishes (via Tweets) the latest earthquakes. We will use a small subset of this dataset and store this on a binary search tree. The data file will contain a record for each quake, consisting of (1) quake magnitude, (2) quake location, and (3) quake date and time. Your search tree will use the magnitude (floating value) as the key, and stored in the search key field. You will store the 3 pieces of information into the data component(use the generic parameter) of the tree node(you may create a class for this). For convenience, you will use the first 3 of these fields to label your nodes(visible on mouseover, but you must use the setLabel() method for that). You will perform the following tasks:
1. Read all of the quake data into the search tree (in the order in which the records are in the file(Done in part 2)). Output: Print to the console (the number of tree nodes via traversal), the full record of the largest quake encountered in the data.
2. Similar to project 1, you will perform the following operations; use standard input(use the Scanner class and its methods to set up an infinite loop) with the following commands:
(a) ’largest’ : Output: traverse the tree and highlight the quake with the largest magnitude. (b) ’reset’ : Output: reset all tree nodes with a default color. (c) ’range min max’ : Output: Highlight the nodes with earthquake magnitude between min and max values in a unique color and highlight the remaining visited nodes in a different color. Note that not all nodes need to be visited, necessitating an efficient traversal. (d) ’find location val’ : Output: this command will take the location (string) and highlight all the nodes that contain this. For example, providing the search string ’Alaska’ will highlight all earthquakes that occurred in Alaska(match the input string to the location field of the quake record(ignore upper/lower case differences). (e) ’find month year’ : Output: this command will take the month (string) and year (string) and highlight all the nodes that contain these two strings in their date field. For example, ’find Mar 2014’ will highlight all earthquakes that occurred in March of 2014 (f) ’quit’ : Output: terminates the program.
Evaluation.
By interactive demo.
Powered by