From 50cdeef195fd1dd5a1d22dc681a1f210291b3c09 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 6 Dec 2019 21:24:41 +0400 Subject: [PATCH] completed homework 1 --- .classpath | 6 +++++ .project | 23 ++++++++++++++++++ .settings/org.eclipse.buildship.core.prefs | 2 ++ .vscode/settings.json | 3 +++ homeworks/HW1/src/main/java/ru.atom/Util.java | 22 +++++++++++------ lecture01/.classpath | 18 ++++++++++++++ lecture01/.project | 23 ++++++++++++++++++ .../org.eclipse.buildship.core.prefs | 2 ++ lecture01/bin/main/ru/atom/HelloWorld.class | Bin 0 -> 660 bytes .../bin/test/ru/atom/HelloWorldTest.class | Bin 0 -> 597 bytes .../src/main/java/ru.atom/HelloWorld.java | 2 +- 11 files changed, 92 insertions(+), 9 deletions(-) create mode 100644 .classpath create mode 100644 .project create mode 100644 .settings/org.eclipse.buildship.core.prefs create mode 100644 .vscode/settings.json create mode 100644 lecture01/.classpath create mode 100644 lecture01/.project create mode 100644 lecture01/.settings/org.eclipse.buildship.core.prefs create mode 100644 lecture01/bin/main/ru/atom/HelloWorld.class create mode 100644 lecture01/bin/test/ru/atom/HelloWorldTest.class diff --git a/.classpath b/.classpath new file mode 100644 index 0000000000..7c0adb019c --- /dev/null +++ b/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000000..0f19520bfb --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ + + + atom + Project atom created by Buildship. + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature + + diff --git a/.settings/org.eclipse.buildship.core.prefs b/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000000..e8895216fd --- /dev/null +++ b/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir= +eclipse.preferences.version=1 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..c5f3f6b9c7 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.configuration.updateBuildConfiguration": "interactive" +} \ No newline at end of file diff --git a/homeworks/HW1/src/main/java/ru.atom/Util.java b/homeworks/HW1/src/main/java/ru.atom/Util.java index 383551b020..fbf455c9ce 100644 --- a/homeworks/HW1/src/main/java/ru.atom/Util.java +++ b/homeworks/HW1/src/main/java/ru.atom/Util.java @@ -1,14 +1,11 @@ package ru.atom; /** - * In this assignment you need to implement the following util methods. - * Note: - * throw new UnsupportedOperationException(); - is just a stub + * In this assignment you need to implement the following util methods. Note: + * throw new UnsupportedOperationException(); - is just a stub */ public class Util { - - /** * Returns the greatest of {@code int} values. * @@ -16,7 +13,13 @@ public class Util { * @return the largest of values. */ public static int max(int[] values) { - throw new UnsupportedOperationException(); + int max = Integer.MIN_VALUE; + for (int val : values) { + if (val > max) { + max = val; + } + } + return max; } /** @@ -26,8 +29,11 @@ public static int max(int[] values) { * @return the sum of all values. */ public static long sum(int[] values) { - throw new UnsupportedOperationException(); + long sum = 0; + for (int val : values) { + sum += val; + } + return sum; } - } diff --git a/lecture01/.classpath b/lecture01/.classpath new file mode 100644 index 0000000000..0fd8806222 --- /dev/null +++ b/lecture01/.classpath @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/lecture01/.project b/lecture01/.project new file mode 100644 index 0000000000..f0c0bf341f --- /dev/null +++ b/lecture01/.project @@ -0,0 +1,23 @@ + + + lecture01 + Project lecture01 created by Buildship. + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature + + diff --git a/lecture01/.settings/org.eclipse.buildship.core.prefs b/lecture01/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000000..b1886adb46 --- /dev/null +++ b/lecture01/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir=.. +eclipse.preferences.version=1 diff --git a/lecture01/bin/main/ru/atom/HelloWorld.class b/lecture01/bin/main/ru/atom/HelloWorld.class new file mode 100644 index 0000000000000000000000000000000000000000..3e3eee42fd0a5d5d9f134232c08cdf48b24d8fcf GIT binary patch literal 660 zcmah`O-}+b6r3UmtRRTrda0fk4{*_o8ZSoUf#?Cm7*A!lfns+{N-_R36HWB)k21a` zL^P0i=u6+r%)FWQ^Xv5;z!7${NHJ9Gs4kp|>Q_>0b7!m$vq&?P`{GH|wTQd*n@(Q_ zj$!ds#mb#AEcn$nL;Bo=GK)MzX^OqD*4P}D7|d;K<#aXb<(=y6AA`8*&i^U$7$9Et^Gu*|UT zH>Q@F&Z@Y3l2|S^R4lJYQAgUAAQu$BVFIDs!m6a74AZWsh74uZ*!-oGb zZ%Gat4151(XDD{1o4z@1^Q*IZ3|`ZWY#=XH;j+ava literal 0 HcmV?d00001 diff --git a/lecture01/bin/test/ru/atom/HelloWorldTest.class b/lecture01/bin/test/ru/atom/HelloWorldTest.class new file mode 100644 index 0000000000000000000000000000000000000000..7e945354b7fdebc514c4d521ddad15ba46b0e86d GIT binary patch literal 597 zcmZvZO;5r=5Qg7HpirwIqJrO^1P}IPJYYFEgE;$usY~{rdj+1aO313n_+G9l6}7k$WwCU)?F~-*-f4ETkEVL;k{Dp9cf? zwl@@g!;n3Zfi$NKbG3SxA$_jyg^fAn9b}MYD0ngu&1lpUy2E?EU?_R2&;2gfGOm9g z)8EMH?G1*7fiQ_AhH5Jcj2wxs3?*^SfK!6vq78=q7c&k^@Y(td3gHTx1LPqA#+U zqD7TUnNiLhyd(EEY1