import java.awt.*; import java.io.*; import java.util.*; // version of the earthquake program that still uses arrays, but that doubles // the size of the array whenever needed to hold more cities public class Earthquake3 { // start with a small number of MAX_CITIES to exercise the grow code public static final int MAX_CITIES = 2; public static void main(String[] args) throws FileNotFoundException { Scanner input = new Scanner(new File("cities.txt")); DrawingPanel panel = new DrawingPanel(200, 200); Graphics g = panel.getGraphics(); Point[] cities = new Point[MAX_CITIES]; int numCities = 0; while(input.hasNextInt()) { // check whether we need more room in the 'cities' array; // if so make one twice as big and copy the points over if (numCities>=cities.length) { Point[] newCities = new Point[2*cities.length]; for (int i=0; i