diff --git a/src/main/java/Main.java b/src/main/java/Main.java new file mode 100644 index 0000000..cd2cdda --- /dev/null +++ b/src/main/java/Main.java @@ -0,0 +1,38 @@ +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Scanner; + +public class Main { + static ArrayList productCatalog = new ArrayList<>(); + public static void loadProducts() throws IOException { + InputStream input = Main.class + .getClassLoader() + .getResourceAsStream("products.csv"); + Scanner scanner = new Scanner(input); + + // TODO: + // - Read each line from products.csv + // - For each line, parse productId, name, and price + // - The format of the file is like this: + // [productId],[name],[price] + // - Store Product objects in the productCatalog ArrayList + + // NOTE + // - The data in products.csv is guaranteed to be valid. + } + + public static void main(String[] args) + { + try { + loadProducts(); + } catch (IOException e) { + System.err.println("Something went wrong with loading products!\nterminating the program..."); + return; + } + + ReportGenerator reportGenerator = new ReportGenerator("2025_order_details.csv", productCatalog); + reportGenerator.processFile(); + reportGenerator.saveReport(); + } +}