Complete class main

This commit is contained in:
2026-05-17 14:31:45 +03:30
parent 8e6d1d1760
commit ff03cf7734
5 changed files with 41 additions and 8 deletions
+10
View File
@@ -0,0 +1,10 @@
# Default ignored files
/shelf/
/workspace.xml
# Ignored default folder with query files
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="25" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/HW-06-exceptions-and-file-handling.iml" filepath="$PROJECT_DIR$/HW-06-exceptions-and-file-handling.iml" />
</modules>
</component>
</project>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
+11 -8
View File
@@ -13,17 +13,20 @@ public class Main {
if (input == null) { if (input == null) {
throw new IOException("products.csv not found"); throw new IOException("products.csv not found");
} }
Scanner scanner = new Scanner(input); Scanner scanner = new Scanner(input);
// TODO: while (scanner.hasNextLine())
// - Read each line from products.csv {
// - For each line, parse productId, name, and price String line = scanner.nextLine();
// - The format of the file is like this: String[] parts = line.split(",");
// [productId],[name],[price] int id = Integer.parseInt(parts[0].trim());
// - Store Product objects in the productCatalog ArrayList String name = parts[1].trim();
Double price = Double.parseDouble(parts[2].trim());
// NOTE productCatalog.add(new Product(id, name, price));
// - The data in products.csv is guaranteed to be valid. }
scanner.close();
} }
public static void main(String[] args) public static void main(String[] args)