This assignment will give you practice writing a C++ application with a linked list and multiple classes. You will also further practice reading CSV files.

computer science

Description

U.S. maps

 This assignment will give you practice writing a C++ application with a linked list and multiple classes. You will also further practice reading CSV files.

The output of your program will be two printed maps: an outline of the continental United States and the same outline with major cities superimposed on it.

 You will complete four classes, Coordinate, City, Node, and SortedLinkedList. You are provided the complete source for main application, MapMaker.cpp.

Input files

Your program will read two CSV (comma-separated value) files as input data.

Input file boundary-data.csv contains the geographic coordinates of locations along the border of the U.S. Each line of the file contains one coordinate consisting of two double values separated by a comma: latitude,longitude

Some example lines from the file:

34.299084,-119.362617

29.47158,-83.302581                   

28.707351,-82.653682

32.342609,-114.426405

The lines are not sorted in any particular order.

Input file city-data.csv contains the names and states of major U.S. cities and their geographic coordinates. Each line of the file contains a city name, state abbreviation, and the latitude and longitude of the city’s geographic coordinates, all separated by commas:

name,state,latitude,longitude

 A few lines from the file:

San Francisco,CA,37.775,-122.4183333

San Jose,CA,37.3394444,-121.8938889

Santa Fe,NM,35.6869444,-105.9372222

The lines are sorted in alphabetical order by city name

Reading comma-separated values Your program must overload the input stream extraction operator >> to read the boundary and city CSV files.

To read the comma-separated values, you can use the getline function. It has an optional parameter to specify a delimiter character, such as the comma.

U.S. boundary map Your program must first read input file border-data.csv to print this boundary map: To generate the map, your program must read the file and create a Coordinate object

from each input line. Class Coordinate must have a friend that overloads the input stream extraction operator >> to read each coordinate. Your program must create a Node object from each Coordinate object. The Node constructor must convert each coordinate to a print position. You are provided the Node member function convert_coordinate that maps a latitude to a row number and a longitude to a column number.

 


Related Questions in computer science category