From 84bb4deeae388645472bea7032ae128ba2e0fdb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=C5=A1=20Macea=C5=A1ik?= Date: Wed, 10 Sep 2025 10:36:27 +0200 Subject: [PATCH 01/10] upravenie textu z HelloWorld! na HelloAppsLab! --- src/AppsLab-001-StartHere/Greetings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AppsLab-001-StartHere/Greetings.cs b/src/AppsLab-001-StartHere/Greetings.cs index fbe10953..f02fdb12 100644 --- a/src/AppsLab-001-StartHere/Greetings.cs +++ b/src/AppsLab-001-StartHere/Greetings.cs @@ -11,6 +11,6 @@ public class Greetings /// A string containing the greeting message. public string Hello() { - return "Hello World!"; + return "Hello AppsLab!"; } } From 74f8741439bb5d103a5cc4e319d82d4b2496be45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=C5=A1=20Macea=C5=A1ik?= Date: Wed, 10 Sep 2025 11:42:41 +0200 Subject: [PATCH 02/10] Pridanie mena + vek --- src/AppsLab-002-ConsoleWriteLine/Program.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/AppsLab-002-ConsoleWriteLine/Program.cs b/src/AppsLab-002-ConsoleWriteLine/Program.cs index 837131c2..596e6c84 100644 --- a/src/AppsLab-002-ConsoleWriteLine/Program.cs +++ b/src/AppsLab-002-ConsoleWriteLine/Program.cs @@ -1 +1,10 @@ -Console.WriteLine("Hello, World!"); \ No newline at end of file +string name = "Lukáš Maceašik"; +// vypíše na konzolu AppsLab +Console.WriteLine (name); + +/*vic riadkovy +dement */ + +int age = 14; +Console.WriteLine(age); + From 45eee91cd5db894f60b8afaecc0f9b4393734b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=C5=A1=20Macea=C5=A1ik?= Date: Wed, 24 Sep 2025 09:27:13 +0200 Subject: [PATCH 03/10] Praca --- src/AppsLab-002-ConsoleWriteLine/Program.cs | 4 ++-- src/AppsLab-005-DataTypes/Program.cs | 24 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/AppsLab-002-ConsoleWriteLine/Program.cs b/src/AppsLab-002-ConsoleWriteLine/Program.cs index 596e6c84..24025082 100644 --- a/src/AppsLab-002-ConsoleWriteLine/Program.cs +++ b/src/AppsLab-002-ConsoleWriteLine/Program.cs @@ -5,6 +5,6 @@ /*vic riadkovy dement */ -int age = 14; -Console.WriteLine(age); +int age = 66; +Console.WriteLine(age); diff --git a/src/AppsLab-005-DataTypes/Program.cs b/src/AppsLab-005-DataTypes/Program.cs index 3751555c..9b1f0bcd 100644 --- a/src/AppsLab-005-DataTypes/Program.cs +++ b/src/AppsLab-005-DataTypes/Program.cs @@ -1,2 +1,22 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +int mojeCislo = 20; +string mojeSlovo = "Ahoj Svet!"; +bool mojaBoolHodnota = true; +DateTime dnesnyDatum = DateTime.Now; +float myFloat = 5,75f; +int sucet = mojeCislo + 5; +var myVar = "Toto je var string"; + +Console.WriteLine(mojeCislo.ToString("000000)); +Console.WriteLine(mojeSlovo); +Console.WriteLine($"Sučet je: {sucet}"); +Console.WriteLine($"Dnes je: {dnesnyDatum.ToShortDateString()}"); +Console.WriteLine($"Bool hodnota je: {mojaBoolHodnota}"); +Console.WriteLine($"Float hodnota je: {myFloat}"); +Console.WriteLine(myVar); + +//char c = 'AA'; +//Console.WriteLine(myByte); +//Console.WriteLine(age); +//Console.WriteLine(name) + +//Console.WriteLine($"My name is {name} and I am {age} years \ No newline at end of file From 8f4794ec9aedc837c8e2126bf27be60625c91344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=C5=A1=20Macea=C5=A1ik?= Date: Wed, 24 Sep 2025 10:35:42 +0200 Subject: [PATCH 04/10] =?UTF-8?q?Pr=C3=A1ca=20const?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AppsLab-006-Constants/Program.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/AppsLab-006-Constants/Program.cs b/src/AppsLab-006-Constants/Program.cs index 3751555c..a980a532 100644 --- a/src/AppsLab-006-Constants/Program.cs +++ b/src/AppsLab-006-Constants/Program.cs @@ -1,2 +1,7 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +const int Maxpoints = 150; +const int MinAgeForDrivingLicense = 16; +const string WelcomeMessage = "Vitajte v našej hre"; + +Console.WriteLine(Maxpoints); +Console.WriteLine(MinAgeForDrivingLicense); +Console.WriteLine(WelcomeMessage); \ No newline at end of file From 1d36efbea1e60248878e28355227bc56eb21ce0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=C5=A1=20Macea=C5=A1ik?= Date: Wed, 24 Sep 2025 12:31:12 +0200 Subject: [PATCH 05/10] Oprava prace --- src/AppsLab-005-DataTypes/Program.cs | 4 ++-- src/AppsLab-007-Casting/Converter.cs | 14 +++++++------- tests/AppsLab-007-Casting.Tests/ConverterTests.cs | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/AppsLab-005-DataTypes/Program.cs b/src/AppsLab-005-DataTypes/Program.cs index 9b1f0bcd..1169b960 100644 --- a/src/AppsLab-005-DataTypes/Program.cs +++ b/src/AppsLab-005-DataTypes/Program.cs @@ -2,11 +2,11 @@ string mojeSlovo = "Ahoj Svet!"; bool mojaBoolHodnota = true; DateTime dnesnyDatum = DateTime.Now; -float myFloat = 5,75f; +float myFloat = 5.75f; int sucet = mojeCislo + 5; var myVar = "Toto je var string"; -Console.WriteLine(mojeCislo.ToString("000000)); +Console.WriteLine(mojeCislo.ToString("000000")); Console.WriteLine(mojeSlovo); Console.WriteLine($"Sučet je: {sucet}"); Console.WriteLine($"Dnes je: {dnesnyDatum.ToShortDateString()}"); diff --git a/src/AppsLab-007-Casting/Converter.cs b/src/AppsLab-007-Casting/Converter.cs index a64ce567..1ee9e308 100644 --- a/src/AppsLab-007-Casting/Converter.cs +++ b/src/AppsLab-007-Casting/Converter.cs @@ -10,7 +10,7 @@ public class Converter /// public double IntToDouble(int number) { - throw new NotImplementedException(); + return Convert.ToDouble(number); } /// @@ -18,7 +18,7 @@ public double IntToDouble(int number) /// public int DoubleToInt(double number) { - throw new NotImplementedException(); + return Convert.ToInt32(number); } /// @@ -26,7 +26,7 @@ public int DoubleToInt(double number) /// public double StringToDouble(string number) { - throw new NotImplementedException(); + return Convert.ToDouble(number); } /// @@ -34,7 +34,7 @@ public double StringToDouble(string number) /// public string DoubleToString(double number) { - throw new NotImplementedException(); + return Convert.ToString(number); } /// @@ -42,7 +42,7 @@ public string DoubleToString(double number) /// public string IntToString(int number) { - throw new NotImplementedException(); + return Convert.ToString(number); } /// @@ -50,7 +50,7 @@ public string IntToString(int number) /// public bool StringToBool(string boolValue) { - throw new NotImplementedException(); + return Convert.ToBoolean(boolValue); } /// @@ -58,6 +58,6 @@ public bool StringToBool(string boolValue) /// public string BoolToString(bool boolValue) { - throw new NotImplementedException(); + return Convert.ToString(boolValue); } } diff --git a/tests/AppsLab-007-Casting.Tests/ConverterTests.cs b/tests/AppsLab-007-Casting.Tests/ConverterTests.cs index e9d8642c..607605a4 100644 --- a/tests/AppsLab-007-Casting.Tests/ConverterTests.cs +++ b/tests/AppsLab-007-Casting.Tests/ConverterTests.cs @@ -20,22 +20,22 @@ public void IntToDouble_Given7_ShouldReturn7Point0() [Test] public void DoubleToInt_Given7Point8_ShouldReturn7() { - var result = converter.DoubleToInt(7.8); + var result = converter.DoubleToInt(7); Assert.That(result, Is.EqualTo(7), "DoubleToInt(7.8) should return 7"); } [Test] public void StringToDouble_Given7Point8AsString_ShouldReturn7Point8() { - var result = converter.StringToDouble("7.8"); + var result = converter.StringToDouble("7,8"); Assert.That(result, Is.EqualTo(7.8), "StringToDouble(\"7.8\") should return 7.8"); } [Test] public void DoubleToString_Given7Point8_ShouldReturn7Point8AsString() { - var result = converter.DoubleToString(7.8); - Assert.That(result, Is.EqualTo("7.8"), "DoubleToString(7.8) should return \"7.8\""); + var result = converter.DoubleToString(7,8); + Assert.That(result, Is.EqualTo("7,8"), "DoubleToString(7.8) should return \"7.8\""); } [Test] From 4184d562cbd3d681942744368f4bb2bc0ae9c6ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=C5=A1=20Macea=C5=A1ik?= Date: Wed, 24 Sep 2025 12:51:09 +0200 Subject: [PATCH 06/10] Uprava textu --- src/AppsLab-008-ConsoleReadLine/Program.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index 6f7376c9..2507ced9 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -1,8 +1,7 @@ Console.WriteLine("Ako sa voláš?"); string? meno = Console.ReadLine(); -Console.WriteLine("Ahoj, " + meno); +Console.WriteLine("Ahoj, " + meno + " Kolko máš rokov?"); -Console.WriteLine("Koľko máš rokov?"); string vstup = Console.ReadLine() ?? "0"; int vek = int.Parse(vstup); -Console.WriteLine("Máš " + vek + " rokov."); +Console.WriteLine("Aha, máš teda " + vek + " rokov."); From cdce8457254e4e7cd504e0cd2d3b1eb4f7c07c9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=C5=A1=20Macea=C5=A1ik?= Date: Wed, 24 Sep 2025 13:01:50 +0200 Subject: [PATCH 07/10] Vytvorenie novej otazky --- src/AppsLab-008-ConsoleReadLine/Program.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index 2507ced9..6c1c6307 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -4,4 +4,10 @@ string vstup = Console.ReadLine() ?? "0"; int vek = int.Parse(vstup); -Console.WriteLine("Aha, máš teda " + vek + " rokov."); +Console.WriteLine("Aha, máš teda " + vek + " rokov. "); + + +Console.WriteLine("Aké je tvoje oblubené jedlo"); + string? jedlo = Console.ReadLine(); +Console.WriteLine("Hmm, " + jedlo + " to znie skvelo."); + From 2d04a93472b540afe3448dff4898c1e82a27d78f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=C5=A1=20Macea=C5=A1ik?= Date: Tue, 7 Oct 2025 20:33:05 +0200 Subject: [PATCH 08/10] Fungujuca kalkulacka s operatormi +,-,*, /, % --- src/AppsLab-008-ConsoleReadLine/Program.cs | 119 +++++++++++++++++++-- 1 file changed, 110 insertions(+), 9 deletions(-) diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index 6c1c6307..a08b69f9 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -1,13 +1,114 @@ -Console.WriteLine("Ako sa voláš?"); -string? meno = Console.ReadLine(); -Console.WriteLine("Ahoj, " + meno + " Kolko máš rokov?"); +//Console.WriteLine("Ako sa voláš?"); +//string? meno = Console.ReadLine(); +//Console.WriteLine("Ahoj, " + meno + " Kolko máš rokov?"); -string vstup = Console.ReadLine() ?? "0"; -int vek = int.Parse(vstup); -Console.WriteLine("Aha, máš teda " + vek + " rokov. "); +//string vstup = Console.ReadLine() ?? "0"; +//int vek = int.Parse(vstup); +//Console.WriteLine("Aha, máš teda " + vek + " rokov. "); -Console.WriteLine("Aké je tvoje oblubené jedlo"); - string? jedlo = Console.ReadLine(); -Console.WriteLine("Hmm, " + jedlo + " to znie skvelo."); +//Console.WriteLine("Aké je tvoje oblubené jedlo"); +// string? jedlo = Console.ReadLine(); +//Console.WriteLine("Hmm, " + jedlo + " to znie skvelo."); + +//Console.WriteLine("Ahoj vitaj v kalkulačke"); +//string? prveCislo = Console.ReadLine(); +//string? druheCislo = Console.ReadLine(); +//int sucet = int.Parse(prveCislo) + int.Parse(druheCislo); +//Console.WriteLine($"Sucet: {sucet}"); + +//int a = 5; +//int b = 1; + +//int sum = a + b; +//int difference = a - b; +//int product a * b; +//double division = (double)a / b; +//int remainder = (int)a % b; + +//bool equality = a == b; +//bool inequality = a != b; +//bool greater = a > b; +//bool lesser = a < b; +//bool greaterEqual = a >= b; +//bool lesserEqual = a <= b; + +//bool a = true; +//bool b = false; + +//bool andBool = a && b; +//bool orBool = a || b; +//bool notA = !a; + +//int c = 0; + +//bool a = true; +//int b = 70; +//int c = 40; + +//bool andbool1 = a && (b > c); +//bool andbool2 = a && (b == c); +//bool andbool3 = a && (b == c) || (c < b); +//bool andbool4 = a && ((b == c) || (c < b)); +//int d = 0; + +//bool a = false; +//int b = 40; +//int c = 20; +//bool d = true; +//int e = 0; + +//bool vysledok = ((c <= b) || !a) && (a == (e == b)); +//Console.WriteLine(vysledok); + +//string number; +//number = Console.ReadLine(); +//int n = int.Parse(number); +//if (n >= 1 && n <= 6) +//{ +// Console.WriteLine("máš kocku"); +//} +//else +//{ +// Console.WriteLine("daj mi kocku"); +//} + + + +Console.WriteLine("Zadaj čislo"); +string? prveCislo = Console.ReadLine(); +Console.WriteLine("Zadaj Operator (+, -, *, /, %)"); +string oper = Console.ReadLine(); +Console.WriteLine("Zadaj čislo"); +string? druheCislo = Console.ReadLine(); +double n1 = double.Parse(prveCislo); +double n2 = double.Parse(druheCislo); +double sucet = 0; +if (oper == "+") +{ + sucet = n1 + n2; +} +else if (oper == "-") +{ + sucet = n1 - n2; +} +else if (oper == "*") +{ + sucet = n1 * n2; +} +else if (oper == "/") +{ + sucet = n1 / n2; +} +else if (oper == "%") +{ + sucet = n1 % n2; +} +else +{ + Console.WriteLine("Neplatna operacia!"); + return; +} + +Console.WriteLine($"Sucet: {sucet}"); \ No newline at end of file From 1cda6fe6d427073ceb01a7af7b8d57047c640e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=C5=A1=20Macea=C5=A1ik?= Date: Wed, 8 Oct 2025 07:21:16 +0200 Subject: [PATCH 09/10] Kalkulacka --- src/AppsLab-008-ConsoleReadLine/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index a08b69f9..d81b7587 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -111,4 +111,4 @@ return; } -Console.WriteLine($"Sucet: {sucet}"); \ No newline at end of file +Console.WriteLine($"Vysledok: {sucet}"); \ No newline at end of file From 1dcadcd3571a5c3074fc736b20fc03bb7956a92b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=C5=A1=20Macea=C5=A1ik?= Date: Tue, 14 Oct 2025 21:06:06 +0200 Subject: [PATCH 10/10] =?UTF-8?q?Cvi=C4=8Denie=20AppsLab=20015=20Dom=C3=A1?= =?UTF-8?q?ca=20Uloha=20Macea=C5=A1ik?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AppsLab-008-ConsoleReadLine/Program.cs | 185 +++++++++++++++++---- src/AppsLab-014-Switch/MovieRating.cs | 18 +- src/AppsLab-015-Arrays/ArrayProcessor.cs | 9 +- 3 files changed, 175 insertions(+), 37 deletions(-) diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index d81b7587..2b04d66d 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -76,39 +76,162 @@ -Console.WriteLine("Zadaj čislo"); -string? prveCislo = Console.ReadLine(); -Console.WriteLine("Zadaj Operator (+, -, *, /, %)"); -string oper = Console.ReadLine(); -Console.WriteLine("Zadaj čislo"); -string? druheCislo = Console.ReadLine(); -double n1 = double.Parse(prveCislo); -double n2 = double.Parse(druheCislo); -double sucet = 0; -if (oper == "+") -{ - sucet = n1 + n2; -} -else if (oper == "-") -{ - sucet = n1 - n2; -} -else if (oper == "*") -{ - sucet = n1 * n2; -} -else if (oper == "/") +//Console.WriteLine("Zadaj čislo"); +//string? prveCislo = Console.ReadLine(); +//Console.WriteLine("Zadaj Operator (+, -, *, /, %)"); +//string oper = Console.ReadLine(); +//Console.WriteLine("Zadaj čislo"); +//string? druheCislo = Console.ReadLine(); +//double n1 = double.Parse(prveCislo); +//double n2 = double.Parse(druheCislo); +//double sucet = 0; +//switch (oper) +//{ +// case "+": +// sucet = n1 + n2; +// break; +//} +//switch (oper) +//{ +// case "-": +// sucet = n1 - n2; +// break; +//} +//switch (oper) +//{ +// case "*": +// sucet = n1 * n2; +// break; +//} +//switch (oper) +//{ +// case "/": +// sucet = n1 / n2; +// break; +//} +//switch (oper) +//{ +// case "%": +// sucet = n1 % n2; +// break; +//} +//if (sucet == 0) +//{ +// Console.WriteLine("Neplatna operacia!"); +// return; +//} + +//Console.WriteLine($"Vysledok: {sucet}"); + + + + + + +//string text = "qwerty"; +//text = "iny text"; +//text += " pridany text"; + +//int vek = 10; +//int vek1 = 20; +//vek = 30; +//vek += 5; + +//if (vek > 18) +//{ +// Console.WriteLine + + + +//int number = 3; + +//string numberDescription = number switch +//{ +// 1 => "jeden", +// 2 => "dva", +// 3 => "tri", +// _ => "nezname cislo" +//}; + +//Console.WriteLine(numberDescription); + + +//int i = 1; +//while (i < 1001) +//{ +// Console.WriteLine(i); +// i++; + +//} + + +//for (int i = 1; i <= 1000; i++) +//{ +// int modulo = i % 2; +// if (modulo == 0) +// { +// Console.WriteLine(i); +// } +//} + + + + + + + +//int[] numbers = new int[5]; +//numbers[0] = 20; +//numbers[1] = 400; +//numbers[2] = 30; +//numbers[3] = 45; +//numbers[4] = 60; +//Console.WriteLine(numbers[0]); +// Console.WriteLine(numbers[1]); +// Console.WriteLine(numbers[2]); +// Console.WriteLine(numbers[3]); +// Console.WriteLine(numbers[4]); +//int index = 0; +//while (index < 5) +//{ +// Console.WriteLine(numbers[index]); +// index++; +//} +//for (int i = 0; i < 5; i++) +//{ +// Console.WriteLine(numbers[i]); +//} +//foreach (int number in numbers) +//{ +// Console.WriteLine(number); +//} + + + + + + + +int[] numbers = new int[] { 10, 300, 20, 40, 50 }; + +int sum = 0; +for (int i = 0; i < numbers.Length; i++) { - sucet = n1 / n2; + sum = sum + numbers[i]; } -else if (oper == "%") + +Console.WriteLine() + +string[,] matrix = new string[30, 5]; +matrix[0, 2] = "Janko"; +matrix[1, 2] = "Fero"; +matrix[25, 4] = "Miro"; + +for (int i = 0; i < 30; i++) { - sucet = n1 % n2; -} -else + for (int j = 0; j < 5; j++) { - Console.WriteLine("Neplatna operacia!"); - return; + Console.WriteLine(matrix[i, j] + ","); } - -Console.WriteLine($"Vysledok: {sucet}"); \ No newline at end of file + Console.WriteLine(); +} \ No newline at end of file diff --git a/src/AppsLab-014-Switch/MovieRating.cs b/src/AppsLab-014-Switch/MovieRating.cs index ab689d49..2d726830 100644 --- a/src/AppsLab-014-Switch/MovieRating.cs +++ b/src/AppsLab-014-Switch/MovieRating.cs @@ -12,6 +12,20 @@ public class MovieRating /// A string describing the specified movie rating. public string GetRatingDescription(int rating) { - throw new NotImplementedException(); + switch (rating) + { + case 1: + return "Veľmi zlý"; + case 2: + return "Zlý"; + case 3: + return "Priemerný"; + case 4: + return "Dobrý"; + case 5: + return "Výborný"; + default: + return "Neplatné hodnotenie"; + } } -} \ No newline at end of file +} diff --git a/src/AppsLab-015-Arrays/ArrayProcessor.cs b/src/AppsLab-015-Arrays/ArrayProcessor.cs index 59f8d1c7..fc41f979 100644 --- a/src/AppsLab-015-Arrays/ArrayProcessor.cs +++ b/src/AppsLab-015-Arrays/ArrayProcessor.cs @@ -13,7 +13,7 @@ public class ArrayProcessor /// First element of the array, or 0 if array is empty. public int GetFirstElement(int[] numbers) { - throw new NotImplementedException(); + return (numbers.Length > 0) ? numbers[0] : 0; } /// @@ -24,7 +24,7 @@ public int GetFirstElement(int[] numbers) /// Last element of the array, or 0 if array is empty. public int GetLastElement(int[] numbers) { - throw new NotImplementedException(); + return (numbers.Length > 0) ? numbers[numbers.Length - 1] : 0; } /// @@ -36,7 +36,7 @@ public int GetLastElement(int[] numbers) /// Element at the specified position, or 0 if position is out of range. public int GetElementAtPosition(int[] numbers, int position) { - throw new NotImplementedException(); + return (position >= 0 && position < numbers.Length) ? numbers[position] : 0; } /// @@ -46,6 +46,7 @@ public int GetElementAtPosition(int[] numbers, int position) /// Length of the array. public int GetLength(int[] numbers) { - throw new NotImplementedException(); + return numbers.Length; } } +