From 1c1aa9a4ccfd15a9557d79ea66e588431ba4cf90 Mon Sep 17 00:00:00 2001 From: Ali Safarli Date: Wed, 18 Feb 2026 17:19:11 +0400 Subject: [PATCH] Add tasks completed --- .gitignore | 39 +++++++++++ .idea/.gitignore | 8 +++ .idea/misc.xml | 6 ++ .idea/vcs.xml | 6 ++ .../main/java/com/ironhack/Main.class | Bin 0 -> 2060 bytes pom.xml | 17 +++++ src/main/java/com/ironhack/Main.java | 63 ++++++++++++++++++ 7 files changed, 139 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/misc.xml create mode 100644 .idea/vcs.xml create mode 100644 out/production/lab-java-loops-and-version-control/main/java/com/ironhack/Main.class create mode 100644 pom.xml create mode 100644 src/main/java/com/ironhack/Main.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..480bdf5 --- /dev/null +++ b/.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/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..07115cd --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ 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/out/production/lab-java-loops-and-version-control/main/java/com/ironhack/Main.class b/out/production/lab-java-loops-and-version-control/main/java/com/ironhack/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..22660e498b66213e2aa04a5ea096570b5f7332b2 GIT binary patch literal 2060 zcmaJ?-%}e^6#gy=S%`ryG=a7Onre$7vbjHyK?J%AG0lquqtN(@%)$i^`N(Gyly+6)5_nhy1=iHm$p6@*aFo(4` zx)3oCO`sbw0rQ@`FAGg+Zx*U+_f*3dh|OBI&ZOLs_bnJ%o?^ym8SDr6z-y@Lh z(nN?QNQyu#dy_y;;G}_538XP1aQq0c0!CXyZ!%yid)URqiq2*%fz!y)!-nO0eoZwT zd%f0@&8G6mLI89nHczDb7n@Ip3w?4tfj5!m$%bq;cAC;x*LT~l@;u84QY@7wN`nx{ z=@ch5hSCv<46=O5K}3*@qkt&`ZzV9T-S)pIWJUU0tV`Q@5Suqc00PmXv#tb=l`UJ{ z*lDdP_qJSXQZiU}h-gK+mfm-SQGd%KnWN=bRBVP$wOU{(yLuE~)Ju1hZjK+JCf#-b zgZi%3B>`daJ>S3V^EmfY2&4$xQg*(Vj*{udsl(=?}nDDk6tj8yJ4S%Y}Z*>M|c z!P3d~>ek9@YS_Ei9LM*3SGFt4-*VQyV=+|YSjJ5Qw>0TBfwM1IwCwxNwkm`T6t>!e zZ1|4LVBZ|ou0jt5k0s=qHYEB1>3s7$bxR~eXERW zs+O|-jO7Iut89(1_y5O4AhBfI$}Kjf=PA#?7Xs%FaeEYH2JQ-sz1o!34*A6yUaYR5 z#k+ZR_@Z%qoBIN1!MQv4E5uJ+bm1M2T1_F|<(TNKFX1wGy|{uIO7!8cX`!9gOyg<1 z9vO%}t=6OFaJAlTu2t(XbG}+P21K!1?=f#w>t@VMRm(ran0$i1Jsbyq!7$gO6eV#c zi8r3$+#V(Z`3opR45GtMBF@l#xXLH;7Loz9p)fpV`Cx+y-B)`W$f~ zgc<*fiT3J8vjhAOI?%vx{s;J^2L1?%^qhwN7^x6_f12~R2a@=myr%aUSM$vE$Q~~2 za~ozh&Ejg_G`b#YP2`zbfq705#x!>qIbOge@=#)a%dCKIi7?CjewH`)v#bQU=`5G9 za5&4riS82|tP literal 0 HcmV?d00001 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..6fd8156 --- /dev/null +++ b/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + com.ironhack + labIronhack + 1.0-SNAPSHOT + + + 17 + 17 + UTF-8 + + + \ No newline at end of file diff --git a/src/main/java/com/ironhack/Main.java b/src/main/java/com/ironhack/Main.java new file mode 100644 index 0000000..741ac59 --- /dev/null +++ b/src/main/java/com/ironhack/Main.java @@ -0,0 +1,63 @@ +package main.java.com.ironhack; + +//TIP To Run code, press or +// click the icon in the gutter. +public class Main { + public static void main(String[] args) { + + //Exercise1 + int[] numbers = {1212, 23, 98, 64, 323, 78, 21}; + System.out.println("Difference between the largest and smallest: " + differenceBetweenMaxMin(numbers)); + + //Exercise2 + firstSecondSmallest(numbers); + + //Exercise3 + System.out.println("Result: " + calculateExpression(2, 5)); + + + } + + //Exercise1 + public static int differenceBetweenMaxMin(int[] array) { + int max = array[0]; + int min = array[0]; + for (int i = 0; i < array.length; i++) { + if (array[i] > max) { + max = array[i]; + } + if (array[i] < min) { + min = array[i]; + } + + } + return max - min; + + + } + + //Exercise2 + public static void firstSecondSmallest(int[] array) { + int min = array[0]; + int min2 = array[0]; + for (int i = 0; i < array.length; i++) { + if (array[i] < min) { + min2 = min; + min = array[i]; + + } else if (array[i] < min2 && min != array[i]) { + min2 = array[i]; + } + } + System.out.println("First smallest element is: " + min); + System.out.println("Second smallest element is: "+ min2); + + + } + + //Exercise3 + public static double calculateExpression(double x, double y) { + double result = Math.pow(x, 2) + Math.pow(4 * y / 5 - x, 2); + return result; + } +} \ No newline at end of file