From 2b70aaf68b051ab5f40306b059e17ee04d06b4ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=A1ko=20=C5=A0romovsk=C3=BD?= Date: Wed, 10 Sep 2025 10:43:35 +0200 Subject: [PATCH 1/6] upravil som AppsLab --- 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 bea8f36d3c4d10412e5a221f16c114133405053a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=A1ko=20=C5=A0romovsk=C3=BD?= Date: Wed, 10 Sep 2025 11:41:20 +0200 Subject: [PATCH 2/6] dal som meno a vek --- src/AppsLab-002-ConsoleWriteLine/Program.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/AppsLab-002-ConsoleWriteLine/Program.cs b/src/AppsLab-002-ConsoleWriteLine/Program.cs index 837131c2..51ffd0e2 100644 --- a/src/AppsLab-002-ConsoleWriteLine/Program.cs +++ b/src/AppsLab-002-ConsoleWriteLine/Program.cs @@ -1 +1,7 @@ -Console.WriteLine("Hello, World!"); \ No newline at end of file +int age = 10; +string name = "george"; + +Console.WriteLine(age); +Console.WriteLine(name); + +Console.WriteLine($"My name is {name} and I am {age} years old."); \ No newline at end of file From 18c2192e2916e520fd7f36b332f9337d4d917fcb Mon Sep 17 00:00:00 2001 From: miskosromo Date: Wed, 24 Sep 2025 10:07:22 +0200 Subject: [PATCH 3/6] uloha5 --- src/AppsLab-005-DataTypes/Program.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/AppsLab-005-DataTypes/Program.cs b/src/AppsLab-005-DataTypes/Program.cs index 3751555c..ce742c7b 100644 --- a/src/AppsLab-005-DataTypes/Program.cs +++ b/src/AppsLab-005-DataTypes/Program.cs @@ -1,2 +1,16 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +int mojeCislo = 1234; +string mojeSlovo = "Ahoj, svet!" +bool mojaBoolHodnota = true; +DateTime dnesnyDatum = DataTime.Now; +float myFloat = 5.75f; +int sucet = mojecislo + 65; +var myVar = "Toto je var string"; + +Console.WriteLine(mojeCislo.ToString("000000")); +Console.WriteLine(mojeSlovo); +Console.WriteLine($"Súčet je: {sucet}"); +Console.WriteLine($"dnes je robotkac{dnesnyDatum.ToString("yyyy-MM-dd")}"); +Console.WriteLine($"mojaBoolHodnota je: {mojaBoolHodnota}"); +Console.WriteLine(myVar); +Console.WriteLine(myFloat); +Console.WriteLine("Maximálny počet študentov v triede je: " + MaxStudents); From 7fdd866b94a47f051401b22e85ac0e250a93c971 Mon Sep 17 00:00:00 2001 From: miskosromo Date: Wed, 24 Sep 2025 10:35:43 +0200 Subject: [PATCH 4/6] uloha6 --- src/AppsLab-006-Constants/Program.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/AppsLab-006-Constants/Program.cs b/src/AppsLab-006-Constants/Program.cs index 3751555c..dc318f12 100644 --- a/src/AppsLab-006-Constants/Program.cs +++ b/src/AppsLab-006-Constants/Program.cs @@ -1,2 +1,8 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +const int MaxPoints = 200; +const int MinAgeForDriversLicense = 16; +const string WelcomeMessage = "Welcome to the Gulag!"; + +Console.WriteLine(MaxPoints); +Console.WriteLine(MinAgeForDriversLicense); +Console.WriteLine(WelcomeMessage); + From 85fc69788e375092936e66b313601b573a742881 Mon Sep 17 00:00:00 2001 From: miskosromo Date: Wed, 24 Sep 2025 12:27:11 +0200 Subject: [PATCH 5/6] uloha7 --- src/AppsLab-005-DataTypes/Program.cs | 8 ++++---- src/AppsLab-007-Casting/Converter.cs | 14 +++++++------- tests/AppsLab-007-Casting.Tests/ConverterTests.cs | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/AppsLab-005-DataTypes/Program.cs b/src/AppsLab-005-DataTypes/Program.cs index ce742c7b..5d41e01b 100644 --- a/src/AppsLab-005-DataTypes/Program.cs +++ b/src/AppsLab-005-DataTypes/Program.cs @@ -1,9 +1,9 @@ int mojeCislo = 1234; -string mojeSlovo = "Ahoj, svet!" +string mojeSlovo = "Ahoj, svet!"; bool mojaBoolHodnota = true; -DateTime dnesnyDatum = DataTime.Now; +DateTime dnesnyDatum = DateTime.Now; float myFloat = 5.75f; -int sucet = mojecislo + 65; +int sucet = mojeCislo + 65; var myVar = "Toto je var string"; Console.WriteLine(mojeCislo.ToString("000000")); @@ -13,4 +13,4 @@ Console.WriteLine($"mojaBoolHodnota je: {mojaBoolHodnota}"); Console.WriteLine(myVar); Console.WriteLine(myFloat); -Console.WriteLine("Maximálny počet študentov v triede je: " + MaxStudents); +Console.WriteLine("Maximálny počet študentov v triede je: " + 30); 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..7885c02d 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); + var result = converter.DoubleToInt(7.4); 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"); } @@ -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 0542a33ac14ce68dcac694cc7de1fcfbdf36ace2 Mon Sep 17 00:00:00 2001 From: miskosromo Date: Wed, 24 Sep 2025 13:01:55 +0200 Subject: [PATCH 6/6] uloha8 --- src/AppsLab-008-ConsoleReadLine/Program.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index 6f7376c9..e1eacd15 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -1,8 +1,11 @@ Console.WriteLine("Ako sa voláš?"); string? meno = Console.ReadLine(); -Console.WriteLine("Ahoj, " + meno); +Console.WriteLine(" Ahoj, " + meno + " koľko 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."); + +Console.WriteLine("Aké je tvoje obľúbené jedlo? "); +string jedlo = Console.ReadLine() ?? "0"; +Console.WriteLine(jedlo + " to znie skvele. ");