title: Inventory Array
body: <p>I'm working on a program that acts as a type of book store inventory. The program reads in a list of information from a text file that looks like this:</p>
  
  <pre><code>1234567 31.67 0
  1234444 98.50 4
  1235555 27.89 2
  1235566 102.39 6
  1240000 75.65 4
  1247761 19.95 12
  1248898 155.91 0
  1356114 6.95 17
  1698304 45.95 3
  281982X 31.90 5
  </code></pre>
  
  <p>The first number represents the ISBN number and is the type String, the second number is the price and is type double, and the final number is the number of copies in stock and is an int. </p>
  
  <p>The program is supposed to read in this information, storing it into an array (more steps follow, but this is the first thing I'm having trouble with). </p>
  
  <p>The code I have so far looks like this:</p>
  
  <pre><code>import java.util.Scanner;
  import java.io.*;
  
  public class Store {
      public static void main(String[] args) {
          String[] books = new String[15];
          String product;
          readInventory();
      }
  
      public static void readInventory() {
          java.io.File file = new java.io.File("../instr/prog4.dat");
          Scanner fin = new Scanner(file);
          String isbn;
          double price;
          int copies; 
          String[] books = new String[14];
              while (fin.hasNext()) {
                   isbn = fin.next();
                   price = fin.nextDouble();
                   copies = fin.nextInt();
              }
  
      }
  }
  </code></pre>
  
  <p>I'm having trouble figuring out how to store these three different pieces of information into a single line (for each item like is depicted in the file) in a single dimensional array. </p>
  
  <p>One thought I had was to created something like this,</p>
  
  <pre><code>String product = (isbn + price + copies);
  </code></pre>
  
  <p>And then try to add this to the array like,</p>
  
  <pre><code>String[] books = product;
  </code></pre>
  
  <p>But as I'm sure you can probably sport, this didn't work. Any suggestions would be greatly appreciated. I'm still really new to this and it's been a while since I've worked with arrays. </p>