@@ -0,0 +1,2672 @@
+/*%0A   Programmers: Kristoffer Larson, Josue Ruiz%0A   Date: May 8, 2014%0A   %0A   Description: Reads in the values from the given file, constructs%0A      WayPoint objects of the appropriate type, and then stores them%0A      in the HashMap.%0A%0A*/%0A%0Aimport java.util.Scanner;%0Aimport java.util.HashMap;%0Aimport java.util.ArrayList;%0Aimport java.awt.Point;%0Aimport java.io.File;%0Aimport java.io.IOException;%0A%0Apublic class FileReader %7B%0A%0A   public HashMap%3CPoint, WayPoint%3E map;%0A   private int c = 0, g = 0, m = 0;%0A   %0A   public FileReader(HashMap%3CPoint, WayPoint%3E map, String fileName) %7B%0A      File sourceFile = new File(fileName);%0A      this.map = map;%0A      %0A      if (!sourceFile.exists()) %7B%0A         System.out.print(fileName + %22 doesn't exist.%22);%0A         System.exit(0);%0A      %7D//End if%0A      %0A      try %7B%0A         Scanner input = new Scanner(sourceFile);%0A         while(input.hasNext()) %7B%0A            readFile(input); %0A         %7D//End while%0A      %7D catch (IOException e) %7B%0A         System.err.println(%22IOException: %22 + e.getMessage());%0A      %7D//End try/catch%0A   %7D//End FileReader() constructor%0A   %0A   private void readFile(Scanner input) %7B%0A      ArrayList%3CPoint%3E neigh = new ArrayList%3CPoint%3E();%0A      int nx, ny;%0A      %0A      //Creates WayPoints with values that are read in%0A      int x = input.nextInt();%0A      int y = input.nextInt();%0A         Point keyPoint = new Point(x, y);%0A      int height = input.nextInt();%0A      int cityValue = input.nextInt();%0A      int gold = input.nextInt();%0A      int mapX = input.nextInt();%0A      int mapY = input.nextInt();%0A      int neighbor = input.nextInt();%0A      %0A      for (int i = 0; i %3C neighbor; i++) %7B%0A         nx = input.nextInt();%0A         ny = input.nextInt();%0A         neigh.add(new Point(nx, ny));%0A      %7D//End loop%0A   %0A      if (cityValue %3E 0) %7B //City WayPoint%0A         c++;%0A         map.put(keyPoint, %0A            (new WayPoint(keyPoint, height, cityValue, neighbor, neigh)));%0A      %7D else if (gold %3E 0) %7B //Gold WayPoint%0A         g++;%0A         map.put(keyPoint, %0A            (new WayPoint(x, y, height, gold, neighbor, neigh)));%0A      %7D else if (mapX %3E 0 %7C%7C mapY %3E 0) %7B //Map WayPoint%0A         m++;%0A         map.put(keyPoint, %0A            (new WayPoint(x, y, height, mapX, mapY, neighbor, neigh)));%0A      %7D else %7B//Normal WayPoint%0A         map.put(keyPoint, %0A            (new WayPoint(x, y, height, neighbor, neigh)));%0A      %7D //End if%0A   %7D//End readFile() method%0A   %0A   public int getNumCities() %7B%0A      return c;%0A   %7D//End getNumCities() method%0A   %0A   public int getNumGold() %7B%0A      return g;%0A   %7D//End getNumGold() method%0A   %0A   public int getNumMaps() %7B%0A      return m;%0A   %7D//End getNumMaps() method%0A   %0A%7D//End FileReader class%0A

Create FileReader.java