Question: package code; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import code.Point2D; /* * Homework 3, part 2 * * This homework is
package code;
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap;
import code.Point2D;
/* * Homework 3, part 2 * * This homework is the second step to a geography-based application and will * give you practice with the following concepts: * * reading data from a file * structuring data * filtering data * * In this homework you will work with a real-world data set that contains * approximately 48,000 city names, locations, and populations from around * the world. The data is in the WorldCitiesPop.csv file in the Data folder. * * Each line of this file has the following structure: * Country,City,AccentCity,Region,Population,Latitude,Longitude * * THE City CLASS * ============== * You will need to keep all the data for a City together in one place. To do * this you define a City class that has an instance variable for the following * fields: * * Country - store this as a String * City - store this as a String * Region - store this as a String * Population - store this as an int * Latitude - store this as a double * Longitude - store this as a double * * Notice that AccentCity is missing - you may safely ignore this field. * * The City class must have a constructor that accepts these values as Strings, * Country, City, Region, Population, Latitude, Longitude * and initializes the above instance variables as expected. * * Define also a simple accessor method for each of the instance variables. * * THE CityPair CLASS * ================== * Sometimes you need to work with pairs of cities rather than just individual * cities. The CityPair class has a constructor that takes two City objects and * stores each in its own instance variable. * * The CityPair class also must have accessors for the two cities in the pair: * * public City cityOne() * public City cityTwo() * * * THE MODEL CLASS * =============== * Define, in the class Model the following methods: * * ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
