From b3197f7afc58184581232fe94366fa9b4eaaf129 Mon Sep 17 00:00:00 2001 From: Matej Kolkus Date: Wed, 10 Sep 2025 10:54:27 +0200 Subject: [PATCH 01/14] opravil som pre buduce generacie --- 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 346f203792427204e3a5fb30ec47026cd26f2ae1 Mon Sep 17 00:00:00 2001 From: Matej Kolkus Date: Wed, 10 Sep 2025 11:41:46 +0200 Subject: [PATCH 02/14] opravil som 2 --- src/AppsLab-002-ConsoleWriteLine/Program.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/AppsLab-002-ConsoleWriteLine/Program.cs b/src/AppsLab-002-ConsoleWriteLine/Program.cs index 837131c2..5eab619f 100644 --- a/src/AppsLab-002-ConsoleWriteLine/Program.cs +++ b/src/AppsLab-002-ConsoleWriteLine/Program.cs @@ -1 +1,6 @@ -Console.WriteLine("Hello, World!"); \ No newline at end of file +int age = 14; +string name = "Matej"; +Console.WriteLine(age); +Console.WriteLine(name); + +Console.WriteLine($"My name is {name} and I am {age} years old."); From 826fcabf78bd4d09cea54f6924c7a893c3b17c3e Mon Sep 17 00:00:00 2001 From: Matej Kolkus Date: Wed, 24 Sep 2025 09:26:29 +0200 Subject: [PATCH 03/14] Urobil som ulohu 5 --- src/AppsLab-002-ConsoleWriteLine/Program.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/AppsLab-002-ConsoleWriteLine/Program.cs b/src/AppsLab-002-ConsoleWriteLine/Program.cs index 5eab619f..0efb248b 100644 --- a/src/AppsLab-002-ConsoleWriteLine/Program.cs +++ b/src/AppsLab-002-ConsoleWriteLine/Program.cs @@ -1,6 +1,15 @@ -int age = 14; -string name = "Matej"; -Console.WriteLine(age); -Console.WriteLine(name); +int mojeCislo = 15; +string mojeSlovo = "Ahoj, svet!"; +bool mojaBoolHodnota = true; +DateTime dnesnyDatum = DateTime.Now; +float myFloat = 5.5f; +int sucet = mojeCislo + 5; +var myVar = "Toto je var string"; +Console.WriteLine(mojeCislo.ToString("000000")); +Console.WriteLine(mojeSlovo); +Console.WriteLine($"Súčet je: {sucet}"); +Console.WriteLine($"Dnes je: {dnesnyDatum.ToString("yyyy-MM-dd")}"); +Console.WriteLine($"Bool hodnota je: {mojaBoolHodnota}"); +Console.WriteLine(myFloat); +Console.WriteLine(myVar); -Console.WriteLine($"My name is {name} and I am {age} years old."); From 513fe37b29b8a94ec41d2d161adb3e526f64c156 Mon Sep 17 00:00:00 2001 From: Matej Kolkus Date: Wed, 24 Sep 2025 10:35:13 +0200 Subject: [PATCH 04/14] Urobil som ulohu 6. --- src/AppsLab-002-ConsoleWriteLine/Program.cs | 18 +++--------------- src/AppsLab-005-DataTypes/Program.cs | 20 ++++++++++++++++++-- src/AppsLab-006-Constants/Program.cs | 8 ++++++-- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/AppsLab-002-ConsoleWriteLine/Program.cs b/src/AppsLab-002-ConsoleWriteLine/Program.cs index 0efb248b..5cb5b80d 100644 --- a/src/AppsLab-002-ConsoleWriteLine/Program.cs +++ b/src/AppsLab-002-ConsoleWriteLine/Program.cs @@ -1,15 +1,3 @@ -int mojeCislo = 15; -string mojeSlovo = "Ahoj, svet!"; -bool mojaBoolHodnota = true; -DateTime dnesnyDatum = DateTime.Now; -float myFloat = 5.5f; -int sucet = mojeCislo + 5; -var myVar = "Toto je var string"; -Console.WriteLine(mojeCislo.ToString("000000")); -Console.WriteLine(mojeSlovo); -Console.WriteLine($"Súčet je: {sucet}"); -Console.WriteLine($"Dnes je: {dnesnyDatum.ToString("yyyy-MM-dd")}"); -Console.WriteLine($"Bool hodnota je: {mojaBoolHodnota}"); -Console.WriteLine(myFloat); -Console.WriteLine(myVar); - +int age = 15; +string name = "Matej"; +Console.WriteLine($"My name is {name} and I am {age}"); \ No newline at end of file diff --git a/src/AppsLab-005-DataTypes/Program.cs b/src/AppsLab-005-DataTypes/Program.cs index 3751555c..8675ef40 100644 --- a/src/AppsLab-005-DataTypes/Program.cs +++ b/src/AppsLab-005-DataTypes/Program.cs @@ -1,2 +1,18 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +int mojeCislo = 15; +string mojeSlovo = "Ahoj, svet!"; +bool mojaBoolHodnota = true; +DateTime dnesnyDatum = DateTime.Now; +float myFloat = 5.5f; +int sucet = mojeCislo + 5; +var myVar = "Toto je var string"; +const int MaxStudents = 15; + +Console.WriteLine(mojeCislo.ToString("000000")); +Console.WriteLine(mojeSlovo); +Console.WriteLine($"Súčet je: {sucet}"); +Console.WriteLine($"Dnes je: {dnesnyDatum.ToString("yyyy-MM-dd")}"); +Console.WriteLine($"Bool hodnota je: {mojaBoolHodnota}"); +Console.WriteLine(myFloat); +Console.WriteLine(myVar); +Console.WriteLine("Maximálny počet študentov v triede je: " + MaxStudents); + diff --git a/src/AppsLab-006-Constants/Program.cs b/src/AppsLab-006-Constants/Program.cs index 3751555c..77f6d1a9 100644 --- a/src/AppsLab-006-Constants/Program.cs +++ b/src/AppsLab-006-Constants/Program.cs @@ -1,2 +1,6 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +const int MaxPoints = 100; +const int MinAgeDriversLicence = 20; +const string WelcomeMessage = "Vitajte v nasej triede"; +Console.WriteLine(MaxPoints); +Console.WriteLine(MinAgeDriversLicence); +Console.WriteLine(WelcomeMessage); From 5dc1e96e72ca3e75973600db574b07643d9b016c Mon Sep 17 00:00:00 2001 From: Matej Kolkus Date: Wed, 24 Sep 2025 12:27:22 +0200 Subject: [PATCH 05/14] Urobil som ulohu 7. --- src/AppsLab-007-Casting/Converter.cs | 14 +++++++------- tests/AppsLab-007-Casting.Tests/ConverterTests.cs | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) 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..daf6e1ba 100644 --- a/tests/AppsLab-007-Casting.Tests/ConverterTests.cs +++ b/tests/AppsLab-007-Casting.Tests/ConverterTests.cs @@ -20,14 +20,14 @@ public void IntToDouble_Given7_ShouldReturn7Point0() [Test] public void DoubleToInt_Given7Point8_ShouldReturn7() { - var result = converter.DoubleToInt(7.8); - Assert.That(result, Is.EqualTo(7), "DoubleToInt(7.8) should return 7"); + var result = converter.DoubleToInt(7.4); + Assert.That(result, Is.EqualTo(7), "DoubleToInt(7.4) 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"); } @@ -35,7 +35,7 @@ public void StringToDouble_Given7Point8AsString_ShouldReturn7Point8() 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\""); + Assert.That(result, Is.EqualTo("7,8"), "DoubleToString(7.8) should return \"7.8\""); } [Test] From 89b598af6eed14deb9100456dab5c9e59fc2fc7f Mon Sep 17 00:00:00 2001 From: Matej Kolkus Date: Wed, 24 Sep 2025 12:50:59 +0200 Subject: [PATCH 06/14] Urobil som ulohu 8. --- src/AppsLab-008-ConsoleReadLine/Program.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index 6f7376c9..691ebb17 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -1,8 +1,6 @@ Console.WriteLine("Ako sa voláš?"); string? meno = Console.ReadLine(); -Console.WriteLine("Ahoj, " + meno); - -Console.WriteLine("Koľko máš rokov?"); +Console.WriteLine($"Ahoj,{meno}! Kolko mas rokov?"); string vstup = Console.ReadLine() ?? "0"; int vek = int.Parse(vstup); -Console.WriteLine("Máš " + vek + " rokov."); +Console.WriteLine("Aha, mas teda 15 rokov"); \ No newline at end of file From c99eece973528aa8766fad2e27eafb04c9b9064f Mon Sep 17 00:00:00 2001 From: Matej Kolkus Date: Wed, 24 Sep 2025 13:06:59 +0200 Subject: [PATCH 07/14] Urobil som kamarata na rozhovor ked si sam. --- src/AppsLab-008-ConsoleReadLine/Program.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index 691ebb17..e6a96493 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -3,4 +3,13 @@ Console.WriteLine($"Ahoj,{meno}! Kolko mas rokov?"); string vstup = Console.ReadLine() ?? "0"; int vek = int.Parse(vstup); -Console.WriteLine("Aha, mas teda 15 rokov"); \ No newline at end of file +Console.WriteLine("Aha, mas teda 15 rokov"); +Console.WriteLine("Ake je tvoje oblubune jedlo?"); +string jedlo = Console.ReadLine(); +Console.WriteLine($"Hmmm, {jedlo} to znie skvele!"); +Console.WriteLine("Aky mas dns den?"); +string den = Console.ReadLine(); +Console.WriteLine($"Tak to mas skvele!"); +Console.WriteLine("Kolko za to dostanem za snahu?"); +string text = Console.ReadLine(); +Console.WriteLine("To je zle! Skus nieco ine!"); From b72633d4955c66e2efc3c2be94b305a31c154315 Mon Sep 17 00:00:00 2001 From: Matej Kolkus Date: Wed, 24 Sep 2025 13:48:28 +0200 Subject: [PATCH 08/14] Doplnenie konzoly. Uloha 8 --- src/AppsLab-008-ConsoleReadLine/Program.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index e6a96493..759d9d0a 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -10,6 +10,11 @@ Console.WriteLine("Aky mas dns den?"); string den = Console.ReadLine(); Console.WriteLine($"Tak to mas skvele!"); -Console.WriteLine("Kolko za to dostanem za snahu?"); +Console.WriteLine("Preco sa rozpravas s robotom?"); string text = Console.ReadLine(); -Console.WriteLine("To je zle! Skus nieco ine!"); +Console.WriteLine("Nemyslis ze si na tom dost zle ked sa musis rozpavat so mnou?"); +string text1 = Console.ReadLine(); +Console.WriteLine($"Tak, to by bolo zatial vsetko. Pokracovanie nabuduce."); +Console.WriteLine("Kolko dostanem cash za tento projekt?"); +string text2= Console.ReadLine(); +Console.WriteLine("Tak neni to moc ale na zaciatok staci!"); \ No newline at end of file From 6825ec41b4d9b505ce9ecaf599ad8e20d59c9caf Mon Sep 17 00:00:00 2001 From: Matej Kolkus Date: Wed, 24 Sep 2025 15:12:39 +0200 Subject: [PATCH 09/14] 2. pokracovanie s konzolou. --- src/AppsLab-008-ConsoleReadLine/Program.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index 759d9d0a..05fc3d29 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -14,6 +14,9 @@ string text = Console.ReadLine(); Console.WriteLine("Nemyslis ze si na tom dost zle ked sa musis rozpavat so mnou?"); string text1 = Console.ReadLine(); +Console.WriteLine("Aka je tvoja oblubena farba?"); +string farba = Console.ReadLine(); +Console.WriteLine($"Hmm, {farba}? Ja poznam aj krajsie ale tak je to tvoja vec. Kazdemu sa paci nieco ine."); Console.WriteLine($"Tak, to by bolo zatial vsetko. Pokracovanie nabuduce."); Console.WriteLine("Kolko dostanem cash za tento projekt?"); string text2= Console.ReadLine(); From 5243342e1cb62f1a611eee60d52211adee628196 Mon Sep 17 00:00:00 2001 From: Matej Kolkus Date: Wed, 24 Sep 2025 18:23:47 +0200 Subject: [PATCH 10/14] Dokoncenie konzoly. --- src/AppsLab-008-ConsoleReadLine/Program.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index 05fc3d29..fbfa7056 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -3,13 +3,13 @@ Console.WriteLine($"Ahoj,{meno}! Kolko mas rokov?"); string vstup = Console.ReadLine() ?? "0"; int vek = int.Parse(vstup); -Console.WriteLine("Aha, mas teda 15 rokov"); +Console.WriteLine($"Aha, mas teda {vek} rokov"); Console.WriteLine("Ake je tvoje oblubune jedlo?"); string jedlo = Console.ReadLine(); Console.WriteLine($"Hmmm, {jedlo} to znie skvele!"); -Console.WriteLine("Aky mas dns den?"); +Console.WriteLine("Aky mas dnes den?"); string den = Console.ReadLine(); -Console.WriteLine($"Tak to mas skvele!"); +Console.WriteLine("Tak to mas skvele!"); Console.WriteLine("Preco sa rozpravas s robotom?"); string text = Console.ReadLine(); Console.WriteLine("Nemyslis ze si na tom dost zle ked sa musis rozpavat so mnou?"); @@ -17,7 +17,11 @@ Console.WriteLine("Aka je tvoja oblubena farba?"); string farba = Console.ReadLine(); Console.WriteLine($"Hmm, {farba}? Ja poznam aj krajsie ale tak je to tvoja vec. Kazdemu sa paci nieco ine."); -Console.WriteLine($"Tak, to by bolo zatial vsetko. Pokracovanie nabuduce."); +Console.WriteLine("Stlac klavesu: "); +var key = Console.ReadKey(); +Console.WriteLine(); +Console.WriteLine($"Stlacili ste klavesu: {key.KeyChar}"); Console.WriteLine("Kolko dostanem cash za tento projekt?"); string text2= Console.ReadLine(); -Console.WriteLine("Tak neni to moc ale na zaciatok staci!"); \ No newline at end of file +Console.WriteLine("Tak neni to moc ale na zaciatok staci!"); +Console.WriteLine($"Tak, to by bolo zatial vsetko. Pokracovanie nabuduce."); From 4672a903b78e95ddbb0ccf83867b2b2cc599e8cb Mon Sep 17 00:00:00 2001 From: Matej Kolkus Date: Wed, 24 Sep 2025 19:00:12 +0200 Subject: [PATCH 11/14] Koniec konzoly. --- src/AppsLab-008-ConsoleReadLine/Program.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index fbfa7056..5252d853 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -24,4 +24,5 @@ Console.WriteLine("Kolko dostanem cash za tento projekt?"); string text2= Console.ReadLine(); Console.WriteLine("Tak neni to moc ale na zaciatok staci!"); -Console.WriteLine($"Tak, to by bolo zatial vsetko. Pokracovanie nabuduce."); +Console.WriteLine($"Tak, to by bolo zatial vsetko."); +Console.WriteLine("Pokracovanie nabuduce"); From 336861866d9f27292ee76445eaac6e1a774bd260 Mon Sep 17 00:00:00 2001 From: Matej Kolkus Date: Wed, 1 Oct 2025 17:42:59 +0200 Subject: [PATCH 12/14] Urobil som kalkulacku. --- AppsLab.CSharp.Exercises.sln | 35 ++++++----- ConsoleApp1/ConsoleApp1.csproj | 10 ++++ ConsoleApp2/ConsoleApp2.csproj | 10 ++++ ConsoleApp2/Program.cs | 29 +++++++++ src/AppsLab-008-ConsoleReadLine/Program.cs | 70 +++++++++++++--------- src/AppsLab-009-Operators/Calculator.cs | 27 ++++----- 6 files changed, 124 insertions(+), 57 deletions(-) create mode 100644 ConsoleApp1/ConsoleApp1.csproj create mode 100644 ConsoleApp2/ConsoleApp2.csproj create mode 100644 ConsoleApp2/Program.cs diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 58bbf6b5..e073c685 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -93,10 +93,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-033-NuGet", "src\Ap EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-034-Debug", "src\AppsLab-034-Debug\AppsLab-034-Debug.csproj", "{83C963FD-DC23-46E8-9545-F56197164810}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp2", "ConsoleApp2\ConsoleApp2.csproj", "{18E65813-FB33-4C61-AAA7-8138DE19DE2A}" +EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -226,18 +225,6 @@ Global {A6659FD2-5F11-432B-91B7-C64EAEAF669C}.Release|x64.Build.0 = Release|Any CPU {A6659FD2-5F11-432B-91B7-C64EAEAF669C}.Release|x86.ActiveCfg = Release|Any CPU {A6659FD2-5F11-432B-91B7-C64EAEAF669C}.Release|x86.Build.0 = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x64.ActiveCfg = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x64.Build.0 = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x86.ActiveCfg = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x86.Build.0 = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|Any CPU.Build.0 = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x64.ActiveCfg = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x64.Build.0 = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x86.ActiveCfg = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x86.Build.0 = Release|Any CPU {FD645D4C-9DC8-4603-A77B-8A4782F175F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FD645D4C-9DC8-4603-A77B-8A4782F175F4}.Debug|Any CPU.Build.0 = Debug|Any CPU {FD645D4C-9DC8-4603-A77B-8A4782F175F4}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -634,6 +621,21 @@ Global {83C963FD-DC23-46E8-9545-F56197164810}.Release|x64.Build.0 = Release|Any CPU {83C963FD-DC23-46E8-9545-F56197164810}.Release|x86.ActiveCfg = Release|Any CPU {83C963FD-DC23-46E8-9545-F56197164810}.Release|x86.Build.0 = Release|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Debug|x64.ActiveCfg = Debug|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Debug|x64.Build.0 = Debug|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Debug|x86.ActiveCfg = Debug|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Debug|x86.Build.0 = Debug|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Release|Any CPU.Build.0 = Release|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Release|x64.ActiveCfg = Release|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Release|x64.Build.0 = Release|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Release|x86.ActiveCfg = Release|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {57860CA2-0054-465E-BD1E-024FF8D81354} = {56555FB0-B513-49EF-9002-A5AF135EA090} @@ -680,4 +682,7 @@ Global {38FFE1DF-4B49-40C1-9908-51860BCF2D3E} = {56555FB0-B513-49EF-9002-A5AF135EA090} {83C963FD-DC23-46E8-9545-F56197164810} = {56555FB0-B513-49EF-9002-A5AF135EA090} EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0463079C-E8B4-4F31-9B34-80769936C76B} + EndGlobalSection EndGlobal diff --git a/ConsoleApp1/ConsoleApp1.csproj b/ConsoleApp1/ConsoleApp1.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/ConsoleApp1/ConsoleApp1.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/ConsoleApp2/ConsoleApp2.csproj b/ConsoleApp2/ConsoleApp2.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/ConsoleApp2/ConsoleApp2.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/ConsoleApp2/Program.cs b/ConsoleApp2/Program.cs new file mode 100644 index 00000000..dd44d8cd --- /dev/null +++ b/ConsoleApp2/Program.cs @@ -0,0 +1,29 @@ + +// nacitam prve cislo (konverziu na cislo) +// nacitam operaciu (nacitam ako string) +// nacitam druhe cislo (konverziu na cislo) +// vykonam operaciu +// vypisem vysledok + +Console.WriteLine("Vitaj v kalkulacke"); +Console.WriteLine("Zadaj prve cislo: "); +int cislo1 = int.Parse(Console.ReadLine()); +Console.WriteLine("Zadaj druhe cislo: "); +int cislo2 = int.Parse(Console.ReadLine()); +Console.WriteLine("Zadaj operaciu (+,-,*,/,%):"); +string operacia = Console.ReadLine(); + +int vyskedok = operacia switch +{ + "+" => (cislo1 + cislo2), + "-" => (cislo1 - cislo2), + "*" => (cislo1 * cislo2), + "/" => (cislo1 / cislo2), + "%" => (cislo1 % cislo2), +}; +Console.WriteLine($"Vysledok je: {vyskedok}"); +Console.WriteLine("Stlac ENTER pre spustenie kalkulacky"); + + + + diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index 5252d853..d93da41a 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -1,28 +1,42 @@ -Console.WriteLine("Ako sa voláš?"); -string? meno = Console.ReadLine(); -Console.WriteLine($"Ahoj,{meno}! Kolko mas rokov?"); -string vstup = Console.ReadLine() ?? "0"; -int vek = int.Parse(vstup); -Console.WriteLine($"Aha, mas teda {vek} rokov"); -Console.WriteLine("Ake je tvoje oblubune jedlo?"); -string jedlo = Console.ReadLine(); -Console.WriteLine($"Hmmm, {jedlo} to znie skvele!"); -Console.WriteLine("Aky mas dnes den?"); -string den = Console.ReadLine(); -Console.WriteLine("Tak to mas skvele!"); -Console.WriteLine("Preco sa rozpravas s robotom?"); -string text = Console.ReadLine(); -Console.WriteLine("Nemyslis ze si na tom dost zle ked sa musis rozpavat so mnou?"); -string text1 = Console.ReadLine(); -Console.WriteLine("Aka je tvoja oblubena farba?"); -string farba = Console.ReadLine(); -Console.WriteLine($"Hmm, {farba}? Ja poznam aj krajsie ale tak je to tvoja vec. Kazdemu sa paci nieco ine."); -Console.WriteLine("Stlac klavesu: "); -var key = Console.ReadKey(); -Console.WriteLine(); -Console.WriteLine($"Stlacili ste klavesu: {key.KeyChar}"); -Console.WriteLine("Kolko dostanem cash za tento projekt?"); -string text2= Console.ReadLine(); -Console.WriteLine("Tak neni to moc ale na zaciatok staci!"); -Console.WriteLine($"Tak, to by bolo zatial vsetko."); -Console.WriteLine("Pokracovanie nabuduce"); +Console.WriteLine("Vitaj v k alkulacke. Dnes budeme robit s cislami."); + +//nacitam cislo +string? prveCislo = Console.ReadLine(); + +//nacitam 2. cislo +string? druheCislo = Console.ReadLine(); + +// spravim sucet +int sucet = int.Parse(prveCislo) + int.Parse(druheCislo); + +// vypisem sucet +Console.WriteLine($"Sucet: {sucet}"); +// + + + + +//int a = 5; +//int b = 3; + + +//int sucet = a + b; // 8 +//int rozdiel = a - b; // 2 +//int nasobok = a * b; // 15 +//int podiel = a / b; // 1 +//int zvysok = a % b; //2 + +//int rovnost = a == b; // false +//int nerovnost = a != b; // true +//int vacsie ako = a > b; // true +//int mensie ako = a < b; // false +//int vacsieAleboRovne = a >= b; // true +//int mensieAleboRovne = a<= b; // false + + + + + + + + diff --git a/src/AppsLab-009-Operators/Calculator.cs b/src/AppsLab-009-Operators/Calculator.cs index 981993a9..f0693029 100644 --- a/src/AppsLab-009-Operators/Calculator.cs +++ b/src/AppsLab-009-Operators/Calculator.cs @@ -10,7 +10,7 @@ public class Calculator /// public int Add(int a, int b) { - throw new NotImplementedException(); + return a + b; } /// @@ -18,7 +18,7 @@ public int Add(int a, int b) /// public int Subtract(int a, int b) { - throw new NotImplementedException(); + return a - b; } /// @@ -26,7 +26,7 @@ public int Subtract(int a, int b) /// public int Multiply(int a, int b) { - throw new NotImplementedException(); + return a * b; } /// @@ -34,7 +34,7 @@ public int Multiply(int a, int b) /// public double Divide(int a, int b) { - throw new NotImplementedException(); + return (double)a / b; } /// @@ -42,7 +42,7 @@ public double Divide(int a, int b) /// public int Remainder(int a, int b) { - throw new NotImplementedException(); + return a % b; } /// @@ -50,7 +50,7 @@ public int Remainder(int a, int b) /// public bool AreEqual(int a, int b) { - throw new NotImplementedException(); + return a == b; } /// @@ -58,7 +58,7 @@ public bool AreEqual(int a, int b) /// public bool AreNotEqual(int a, int b) { - throw new NotImplementedException(); + return a != b; } /// @@ -66,30 +66,29 @@ public bool AreNotEqual(int a, int b) /// public bool IsGreater(int a, int b) { - throw new NotImplementedException(); + return a > b; } /// /// This method returns true if the first integer is lesser than the second. /// - public bool IsLesser(int a, int b) + public bool IsLesser (int a, int b) { - throw new NotImplementedException(); + return a < b; } /// /// This method returns true if the first integer is greater than or equal to the second. /// - public bool IsGreaterOrEqual(int a, int b) + public bool IsGreaterOrEqual (int a, int b ) { - throw new NotImplementedException(); + return a >= b; } - /// /// This method returns true if the first integer is lesser than or equal to the second. /// public bool IsLesserOrEqual(int a, int b) { - throw new NotImplementedException(); + return a <= b; } } From 5dac39f654ea050defee31fc4394293a38c688a8 Mon Sep 17 00:00:00 2001 From: Matej Kolkus Date: Wed, 8 Oct 2025 10:57:36 +0200 Subject: [PATCH 13/14] Urobil som kalkulacku 2 --- ConsoleApp2/Program.cs | 28 +++++++++++---------------- ConsoleApp3/ConsoleApp3.csproj | 10 ++++++++++ ConsoleApp3/Program.cs | 17 ++++++++++++++++ ConsoleApp4/ConsoleApp4.csproj | 10 ++++++++++ ConsoleApp4/Program.cs | 18 +++++++++++++++++ src/AppsLab-014-Switch/MovieRating.cs | 19 ++++++++++++++++-- 6 files changed, 83 insertions(+), 19 deletions(-) create mode 100644 ConsoleApp3/ConsoleApp3.csproj create mode 100644 ConsoleApp3/Program.cs create mode 100644 ConsoleApp4/ConsoleApp4.csproj create mode 100644 ConsoleApp4/Program.cs diff --git a/ConsoleApp2/Program.cs b/ConsoleApp2/Program.cs index dd44d8cd..8de3681c 100644 --- a/ConsoleApp2/Program.cs +++ b/ConsoleApp2/Program.cs @@ -1,5 +1,4 @@ - -// nacitam prve cislo (konverziu na cislo) +// nacitam prve cislo (konverziu na cislo) // nacitam operaciu (nacitam ako string) // nacitam druhe cislo (konverziu na cislo) // vykonam operaciu @@ -7,23 +6,18 @@ Console.WriteLine("Vitaj v kalkulacke"); Console.WriteLine("Zadaj prve cislo: "); -int cislo1 = int.Parse(Console.ReadLine()); +decimal cislo1 = decimal.Parse(Console.ReadLine()); Console.WriteLine("Zadaj druhe cislo: "); -int cislo2 = int.Parse(Console.ReadLine()); +decimal cislo2 = decimal.Parse(Console.ReadLine()); Console.WriteLine("Zadaj operaciu (+,-,*,/,%):"); string operacia = Console.ReadLine(); -int vyskedok = operacia switch +int vysledok = operacia switch { - "+" => (cislo1 + cislo2), - "-" => (cislo1 - cislo2), - "*" => (cislo1 * cislo2), - "/" => (cislo1 / cislo2), - "%" => (cislo1 % cislo2), -}; -Console.WriteLine($"Vysledok je: {vyskedok}"); -Console.WriteLine("Stlac ENTER pre spustenie kalkulacky"); - - - - + "+" => (int)(cislo1 + cislo2), + "-" => (int)(cislo1 - cislo2), + "*" => (int)(cislo1 * cislo2), + "/" => (int)(cislo1 / cislo2), + "%" => (int)(cislo1 % cislo2), + _ => throw new Exception("Neznamy operator") +}; \ No newline at end of file diff --git a/ConsoleApp3/ConsoleApp3.csproj b/ConsoleApp3/ConsoleApp3.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/ConsoleApp3/ConsoleApp3.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/ConsoleApp3/Program.cs b/ConsoleApp3/Program.cs new file mode 100644 index 00000000..83092b4c --- /dev/null +++ b/ConsoleApp3/Program.cs @@ -0,0 +1,17 @@ +string text = "quarty"; +taxt = "iny text"; +text += "dalsi text"; + +int vek = 5; +int vek1 = 10; +vek = 15; +vek += 5; + +if (vek > 18) +{ + Console.WriteLine("Si dospely"); +} +else +{ + Console.WriteLine("Som dieta "); +} \ No newline at end of file diff --git a/ConsoleApp4/ConsoleApp4.csproj b/ConsoleApp4/ConsoleApp4.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/ConsoleApp4/ConsoleApp4.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/ConsoleApp4/Program.cs b/ConsoleApp4/Program.cs new file mode 100644 index 00000000..2da0b00f --- /dev/null +++ b/ConsoleApp4/Program.cs @@ -0,0 +1,18 @@ + +string text = "quarty"; +taxt = "iny text"; +text += "dalsi text"; + +int vek = 5; +int vek1 = 10; +vek = 15; +vek += 5; + +if (vek > 18) +{ + Console.WriteLine("Si dospely"); +} +else +{ + Console.WriteLine("Som dieta "); +} \ No newline at end of file diff --git a/src/AppsLab-014-Switch/MovieRating.cs b/src/AppsLab-014-Switch/MovieRating.cs index ab689d49..2d65f702 100644 --- a/src/AppsLab-014-Switch/MovieRating.cs +++ b/src/AppsLab-014-Switch/MovieRating.cs @@ -12,6 +12,21 @@ 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 +} + \ No newline at end of file From 5b15e9c7f426739e69a8182ce37fabf6827e1011 Mon Sep 17 00:00:00 2001 From: Matej Kolkus Date: Sun, 12 Oct 2025 17:21:46 +0200 Subject: [PATCH 14/14] Urobil som 15 ulohu. --- ConsoleApp2/Program.cs | 36 ++++++------- src/AppsLab-008-ConsoleReadLine/Program.cs | 59 +++++++--------------- src/AppsLab-015-Arrays/ArrayProcessor.cs | 27 ++++++++-- 3 files changed, 54 insertions(+), 68 deletions(-) diff --git a/ConsoleApp2/Program.cs b/ConsoleApp2/Program.cs index 8de3681c..fe91c201 100644 --- a/ConsoleApp2/Program.cs +++ b/ConsoleApp2/Program.cs @@ -1,23 +1,17 @@ -// nacitam prve cislo (konverziu na cislo) -// nacitam operaciu (nacitam ako string) -// nacitam druhe cislo (konverziu na cislo) -// vykonam operaciu -// vypisem vysledok +string[] names = new string[] { "Michal", "Matej", "Alex", "David", "Eva" }; +string[,] matrix = new string [ 30, 5 ]; +matrix [0, 2] = "Michal"; +matrix [1, 2] = "Matej"; +matrix [25, 4] = "Alex"; +matrix [29, 0] = "David"; +for (int i =0; i < 30; i++) +{ + for (int j = 0; j < 5; j++) + { + Console.WriteLine(matrix [i, j] + ", "); + } + Console.WriteLine(); +} + -Console.WriteLine("Vitaj v kalkulacke"); -Console.WriteLine("Zadaj prve cislo: "); -decimal cislo1 = decimal.Parse(Console.ReadLine()); -Console.WriteLine("Zadaj druhe cislo: "); -decimal cislo2 = decimal.Parse(Console.ReadLine()); -Console.WriteLine("Zadaj operaciu (+,-,*,/,%):"); -string operacia = Console.ReadLine(); -int vysledok = operacia switch -{ - "+" => (int)(cislo1 + cislo2), - "-" => (int)(cislo1 - cislo2), - "*" => (int)(cislo1 * cislo2), - "/" => (int)(cislo1 / cislo2), - "%" => (int)(cislo1 % cislo2), - _ => throw new Exception("Neznamy operator") -}; \ No newline at end of file diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index d93da41a..448f4698 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -1,42 +1,17 @@ -Console.WriteLine("Vitaj v k alkulacke. Dnes budeme robit s cislami."); - -//nacitam cislo -string? prveCislo = Console.ReadLine(); - -//nacitam 2. cislo -string? druheCislo = Console.ReadLine(); - -// spravim sucet -int sucet = int.Parse(prveCislo) + int.Parse(druheCislo); - -// vypisem sucet -Console.WriteLine($"Sucet: {sucet}"); -// - - - - -//int a = 5; -//int b = 3; - - -//int sucet = a + b; // 8 -//int rozdiel = a - b; // 2 -//int nasobok = a * b; // 15 -//int podiel = a / b; // 1 -//int zvysok = a % b; //2 - -//int rovnost = a == b; // false -//int nerovnost = a != b; // true -//int vacsie ako = a > b; // true -//int mensie ako = a < b; // false -//int vacsieAleboRovne = a >= b; // true -//int mensieAleboRovne = a<= b; // false - - - - - - - - +Console.WriteLine("Vitaj v kalkulacke"); +Console.WriteLine("Zadaj prve cislo: "); +decimal cislo1 = decimal.Parse(Console.ReadLine()); +Console.WriteLine("Zadaj druhe cislo: "); +decimal cislo2 = decimal.Parse(Console.ReadLine()); +Console.WriteLine("Zadaj operaciu (+,-,*,/,%):"); +string operacia = Console.ReadLine(); + +int vysledok = operacia switch +{ + "+" => (int)(cislo1 + cislo2), + "-" => (int)(cislo1 - cislo2), + "*" => (int)(cislo1 * cislo2), + "/" => (int)(cislo1 / cislo2), + "%" => (int)(cislo1 % cislo2), + _ => throw new Exception("Neznamy operator") +}; \ No newline at end of file diff --git a/src/AppsLab-015-Arrays/ArrayProcessor.cs b/src/AppsLab-015-Arrays/ArrayProcessor.cs index 59f8d1c7..8757b91a 100644 --- a/src/AppsLab-015-Arrays/ArrayProcessor.cs +++ b/src/AppsLab-015-Arrays/ArrayProcessor.cs @@ -1,4 +1,6 @@ -namespace AppsLab_015_Arrays; +using System.Security.Cryptography; + +namespace AppsLab_015_Arrays; /// /// Class ArrayProcessor provides methods for working with integer arrays. @@ -13,7 +15,12 @@ public class ArrayProcessor /// First element of the array, or 0 if array is empty. public int GetFirstElement(int[] numbers) { - throw new NotImplementedException(); + if (numbers.Length == 0) + { + return 0; + } + return numbers[0]; + } /// @@ -24,7 +31,12 @@ public int GetFirstElement(int[] numbers) /// Last element of the array, or 0 if array is empty. public int GetLastElement(int[] numbers) { - throw new NotImplementedException(); + if (numbers.Length == 0) + { + return 0; + } + return numbers[numbers.Length - 1]; + } /// @@ -36,7 +48,12 @@ 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(); + if (position < 0 || position >= numbers.Length) + { + return 0; + } + return numbers[position]; + } /// @@ -46,6 +63,6 @@ public int GetElementAtPosition(int[] numbers, int position) /// Length of the array. public int GetLength(int[] numbers) { - throw new NotImplementedException(); + return numbers.Length; } }