title: Store X, Y Boundary Coordinates in Node for LinkedList
body: <p>I am having a hard time getting this assignment done for school. There is more to it than just what is in the title, but basically this is what I need to do first. Read each line of the text file that have an x and a y point, extract them, and store them in a new node. I then need to add this new node into a linked list and repeat for every x y coordinate. No arrays are to be used.</p>
  
  <p>This is the code I have so far:</p>
  
  <pre><code>public class Point {
  
  public int data;
  public Point next;
  
  public Point(int data, Point next) {
      this.data = data;
      this.next = next;
  }
  
  @Override
  public String toString() {
      return data + "";
  }
  
  }
  
  public class ShapeAbstraction {
  
  public void readCoordinates() {
      String fileName = "shapelist.txt";
      String line = null;
  
      try {
          FileReader fileReader = new FileReader(fileName);
          BufferedReader bufferedReader = new BufferedReader(fileReader);
  
          while((line = bufferedReader.readLine()) != null) {
  
              System.out.println(line);
          } 
          bufferedReader.close();
      }
  
      catch(FileNotFoundException ex) {
          System.out.println("Unable to open file " + fileName);
      }
  
      catch(IOException ex) {
          System.out.println("Error reading file" + fileName);
      }
  
  }
  
  public static void main(String[] args) {
      ShapeAbstraction sa = new ShapeAbstraction();
      sa.readCoordinates();
  
      Point front = new Point(0, null);
      System.out.println(front);
  }
  
  }
  </code></pre>
  
  <p>The coordinates in the .txt file look like this</p>
  
  <pre><code>10 0
  18 0
  17 2
  21 7
  19 12
  </code></pre>
  
  <p>That's only the first 5 out of hundreds.</p>
  
  <p>If someone could help that would be amazing. Thanks.
  <a href="http://knight.temple.edu/~lakamper/courses/cis2168_2014Spring/assignments/Assignment4.pdf" rel="nofollow">Assignment for reference</a> BTW we are now allowed to use the java linked list class.</p>