feat: update Main.java todos
This commit is contained in:
+10
-2
@@ -1,6 +1,7 @@
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
@@ -9,6 +10,9 @@ public class Main {
|
|||||||
InputStream input = Main.class
|
InputStream input = Main.class
|
||||||
.getClassLoader()
|
.getClassLoader()
|
||||||
.getResourceAsStream("products.csv");
|
.getResourceAsStream("products.csv");
|
||||||
|
if (input == null) {
|
||||||
|
throw new IOException("products.csv not found");
|
||||||
|
}
|
||||||
Scanner scanner = new Scanner(input);
|
Scanner scanner = new Scanner(input);
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
@@ -27,12 +31,16 @@ public class Main {
|
|||||||
try {
|
try {
|
||||||
loadProducts();
|
loadProducts();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println("Something went wrong with loading products!\nterminating the program...");
|
System.err.println("Error reading products");
|
||||||
|
System.out.println("Terminating the program...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
System.out.println("=== Products loaded");
|
||||||
|
|
||||||
ReportGenerator reportGenerator = new ReportGenerator("2025_order_details.csv", productCatalog);
|
ReportGenerator reportGenerator = new ReportGenerator("2025_order_details.csv", Collections.unmodifiableList(productCatalog));
|
||||||
reportGenerator.processFile();
|
reportGenerator.processFile();
|
||||||
|
System.out.println("=== Order file processed");
|
||||||
reportGenerator.saveReport();
|
reportGenerator.saveReport();
|
||||||
|
System.out.println("=== Report saved as report.txt");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user