import java.awt.*; import java.io.*; import java.util.*; // version of the Earthquake program that uses an ArrayList to hold the cities public class Earthquake4 { 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(); ArrayList cities = new ArrayList(); while(input.hasNextInt()) { Point p = new Point(input.nextInt(), input.nextInt()); cities.add(p); p.draw(g); } Scanner console = new Scanner(System.in); System.out.print("Epicenter x/y? "); // 100 80 int x = console.nextInt(); int y = console.nextInt(); System.out.print("Radius of effect? "); // 75 int radius = console.nextInt(); Circle quake = new Circle(new Point(x, y), radius); quake.draw(g, false); // don't draw center dot g.setColor(Color.RED); for (int i = 0; i < cities.size(); i++) { if (quake.contains(cities.get(i))) { panel.sleep(500); cities.get(i).draw(g); } } } }