Question: The program is designed to open and read two CSV files through command - line arguments. The file named boundary.csv serves as the input, containing
The program is designed to open and read two CSV files through commandline arguments. The file named boundary.csv serves as the input, containing geographic coordinates of locations along the United States border. Each line in the file represents one coordinate, comprising two double values separated by a comma.
In contrast, the city.csv input file comprises statecity names along with their corresponding geographic coordinates. Each line in the file includes a city name, a state abbreviation, and the latitude and longitude of the citys geographic coordinates, all separated by commas.
Prompt user to open a file
To produce the map, your program needs to parse the file and instantiate a Coordinate object for each input line. Subsequently, a Node object should be created from each Coordinate object. The implementation should include a function named convertCoordinate responsible for mapping a latitude to a row number and a longitude to a column number for a given Node and Coordinate. Following this, the program should insert the Node object into a sorted array or vector, maintaining the sorting based on row number and then column number. After processing all the boundary coordinates, the program should iterate through the entire array or vector to generate the boundary map. To facilitate Node insertion, the implementation should include an insertNode function that takes an array or vector of Nodes. Additionally, an isNodeLessThan function must be written to internally compare two Nodes, aiding the insertN ode function in determining the correct position for inserting a new Node.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
