diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..ab1f416 --- /dev/null +++ b/.idea/.gitignore @@ -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/ diff --git a/.idea/lab-java-maven.iml b/.idea/lab-java-maven.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/lab-java-maven.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..4b151ab --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..99bd203 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/solution-lab-2.02-maven/.gitignore b/solution-lab-2.02-maven/.gitignore new file mode 100644 index 0000000..480bdf5 --- /dev/null +++ b/solution-lab-2.02-maven/.gitignore @@ -0,0 +1,39 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ +.kotlin + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/solution-lab-2.02-maven/.idea/.gitignore b/solution-lab-2.02-maven/.idea/.gitignore new file mode 100644 index 0000000..ab1f416 --- /dev/null +++ b/solution-lab-2.02-maven/.idea/.gitignore @@ -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/ diff --git a/solution-lab-2.02-maven/.idea/encodings.xml b/solution-lab-2.02-maven/.idea/encodings.xml new file mode 100644 index 0000000..103c347 --- /dev/null +++ b/solution-lab-2.02-maven/.idea/encodings.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/solution-lab-2.02-maven/.idea/misc.xml b/solution-lab-2.02-maven/.idea/misc.xml new file mode 100644 index 0000000..74f0c2c --- /dev/null +++ b/solution-lab-2.02-maven/.idea/misc.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/solution-lab-2.02-maven/.idea/vcs.xml b/solution-lab-2.02-maven/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/solution-lab-2.02-maven/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/solution-lab-2.02-maven/order-data/pom.xml b/solution-lab-2.02-maven/order-data/pom.xml new file mode 100644 index 0000000..9a95319 --- /dev/null +++ b/solution-lab-2.02-maven/order-data/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + + com.ironhack + solution-lab-2.02-maven + 1.0-SNAPSHOT + + + order-data + + + 21 + 21 + UTF-8 + + + + + com.google.code.gson + gson + 2.13.2 + + + + \ No newline at end of file diff --git a/solution-lab-2.02-maven/order-data/src/main/java/com/example/data/Order.java b/solution-lab-2.02-maven/order-data/src/main/java/com/example/data/Order.java new file mode 100644 index 0000000..200e213 --- /dev/null +++ b/solution-lab-2.02-maven/order-data/src/main/java/com/example/data/Order.java @@ -0,0 +1,14 @@ +package com.example.data; +import java.util.List; + +public class Order { + private String orderId; + private String customer; + private List items; + private double total; + + public String getOrderId() { return orderId; } + public String getCustomer() { return customer; } + public List getItems() { return items; } + public double getTotal() { return total; } +} \ No newline at end of file diff --git a/solution-lab-2.02-maven/order-data/src/main/java/com/example/data/OrderItem.java b/solution-lab-2.02-maven/order-data/src/main/java/com/example/data/OrderItem.java new file mode 100644 index 0000000..1736d24 --- /dev/null +++ b/solution-lab-2.02-maven/order-data/src/main/java/com/example/data/OrderItem.java @@ -0,0 +1,9 @@ +package com.example.data; + +public class OrderItem { + private String name; + private double price; + + public String getName() { return name; } + public double getPrice() { return price; } +} \ No newline at end of file diff --git a/solution-lab-2.02-maven/order-data/src/main/java/com/example/data/OrderProcessor.java b/solution-lab-2.02-maven/order-data/src/main/java/com/example/data/OrderProcessor.java new file mode 100644 index 0000000..95aa793 --- /dev/null +++ b/solution-lab-2.02-maven/order-data/src/main/java/com/example/data/OrderProcessor.java @@ -0,0 +1,22 @@ +package com.example.data; +import com.google.gson.Gson; + +public class OrderProcessor { + + public static Order parseOrderJson(String json) { + Gson gson = new Gson(); + return gson.fromJson(json, Order.class); + } + + public static void main(String[] args) { + + String sampleJson = "{ \"orderId\": \"ORD-123\", \"customer\": \"Veli Aliyev\", \"items\": [ {\"name\": \"Notebook\", \"price\": 1500.0}, {\"name\": \"Mouse\", \"price\": 50.0} ], \"total\": 1550.0 }"; + + Order order = parseOrderJson(sampleJson); + + System.out.println("=== ORDER DATA MODULE ==="); + System.out.println("Order ID: " + order.getOrderId()); + System.out.println("Customer: " + order.getCustomer()); + System.out.println("Items: " + order.getItems().size()); + } +} \ No newline at end of file diff --git a/solution-lab-2.02-maven/order-logic/pom.xml b/solution-lab-2.02-maven/order-logic/pom.xml new file mode 100644 index 0000000..cc2f0c3 --- /dev/null +++ b/solution-lab-2.02-maven/order-logic/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + + com.ironhack + solution-lab-2.02-maven + 1.0-SNAPSHOT + + + order-logic + + + 21 + 21 + UTF-8 + + + + + com.ironhack + order-data + 1.0-SNAPSHOT + + + + \ No newline at end of file diff --git a/solution-lab-2.02-maven/order-logic/src/main/java/com/example/logic/OrderCalculator.java b/solution-lab-2.02-maven/order-logic/src/main/java/com/example/logic/OrderCalculator.java new file mode 100644 index 0000000..e110bca --- /dev/null +++ b/solution-lab-2.02-maven/order-logic/src/main/java/com/example/logic/OrderCalculator.java @@ -0,0 +1,30 @@ +package com.example.logic; + +import com.example.data.Order; +import com.example.data.OrderItem; +import com.example.data.OrderProcessor; + +public class OrderCalculator { + public static void main(String[] args) { + String sampleJson = "{ \"orderId\": \"ORD-123\", \"customer\": \"Veli Aliyev\", \"items\": [ {\"name\": \"Notebook\", \"price\": 1500.0}, {\"name\": \"Mouse\", \"price\": 50.0} ], \"total\": 1550.0 }"; + + Order order = OrderProcessor.parseOrderJson(sampleJson); + + System.out.println("=== ORDER LOGIC MODULE ==="); + System.out.println("Order Tracking: " + order.getOrderId()); + + double calculatedTotal = 0; + for (OrderItem item : order.getItems()) { + calculatedTotal += item.getPrice(); + } + + System.out.println("Total from JSON: " + order.getTotal()); + System.out.println("Calculated Total: " + calculatedTotal); + + if (Double.compare(calculatedTotal, order.getTotal()) == 0) { + System.out.println("Result: Correct!"); + } else { + System.out.println("Result: Error!"); + } + } +} \ No newline at end of file diff --git a/solution-lab-2.02-maven/pom.xml b/solution-lab-2.02-maven/pom.xml new file mode 100644 index 0000000..0de43d1 --- /dev/null +++ b/solution-lab-2.02-maven/pom.xml @@ -0,0 +1,31 @@ + + + 4.0.0 + + com.ironhack + solution-lab-2.02-maven + 1.0-SNAPSHOT + pom + + order-data + order-logic + + + + 21 + 21 + UTF-8 + + + + + com.google.code.gson + gson + 2.13.2 + compile + + + + \ No newline at end of file