store - NathanMaupin/food GitHub Wiki

import java.util.Scanner; import java.io.File;

public class Store{ public static void main(String[] args) throws Exception {

    System.out.println("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
    System.out.println("=-=-=-Welcome to CheckOS-=-=-=");
    System.out.println("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");

    Scanner reader = new Scanner(new File ("products.txt"));

    int a[] = new int[5];
    Product p[] =  new Product[18];
    int j = 0;
    while(reader.hasNext()) {
        int i = reader.nextInt();
        String temp = reader.next();
        Double price = reader.nextDouble();

        p[j] = new Product(i, temp, price);
        j++;
    }
    System.out.print(p);
}

}