This commit is contained in:
2026-05-23 03:10:30 +03:30
parent 8e6d1d1760
commit 5111e30762
2 changed files with 93 additions and 0 deletions
+17
View File
@@ -1,7 +1,10 @@
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class Main {
@@ -15,6 +18,20 @@ public class Main {
}
Scanner scanner = new Scanner(input);
int productId=0;
String name=" ";
double price=0;
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
String[] parts = line.split(",");
productId = Integer.parseInt(parts[0]);
price= Double.parseDouble(parts[2]);
Product p= new Product(productId, parts[1],price);
productCatalog.add(p);
}
// TODO:
// - Read each line from products.csv
// - For each line, parse productId, name, and price