diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln
index 58bbf6b5..82d5aa19 100644
--- a/AppsLab.CSharp.Exercises.sln
+++ b/AppsLab.CSharp.Exercises.sln
@@ -93,10 +93,13 @@ 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}") = "test", "test\test.csproj", "{5524A60A-E442-43DC-B5D3-F12129B2B1DB}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "projekt1", "projekt1\projekt1.csproj", "{A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "kalkulacka", "ROJEKT2\kalkulacka.csproj", "{C8E34CC7-534B-4183-8794-CEE3803436BE}"
+EndProject
Global
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
@@ -226,18 +229,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 +625,45 @@ 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
+ {5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Debug|x64.Build.0 = Debug|Any CPU
+ {5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Debug|x86.Build.0 = Debug|Any CPU
+ {5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Release|x64.ActiveCfg = Release|Any CPU
+ {5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Release|x64.Build.0 = Release|Any CPU
+ {5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Release|x86.ActiveCfg = Release|Any CPU
+ {5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Release|x86.Build.0 = Release|Any CPU
+ {A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Debug|x64.Build.0 = Debug|Any CPU
+ {A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Debug|x86.Build.0 = Debug|Any CPU
+ {A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Release|x64.ActiveCfg = Release|Any CPU
+ {A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Release|x64.Build.0 = Release|Any CPU
+ {A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Release|x86.ActiveCfg = Release|Any CPU
+ {A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Release|x86.Build.0 = Release|Any CPU
+ {C8E34CC7-534B-4183-8794-CEE3803436BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C8E34CC7-534B-4183-8794-CEE3803436BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C8E34CC7-534B-4183-8794-CEE3803436BE}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {C8E34CC7-534B-4183-8794-CEE3803436BE}.Debug|x64.Build.0 = Debug|Any CPU
+ {C8E34CC7-534B-4183-8794-CEE3803436BE}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {C8E34CC7-534B-4183-8794-CEE3803436BE}.Debug|x86.Build.0 = Debug|Any CPU
+ {C8E34CC7-534B-4183-8794-CEE3803436BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C8E34CC7-534B-4183-8794-CEE3803436BE}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C8E34CC7-534B-4183-8794-CEE3803436BE}.Release|x64.ActiveCfg = Release|Any CPU
+ {C8E34CC7-534B-4183-8794-CEE3803436BE}.Release|x64.Build.0 = Release|Any CPU
+ {C8E34CC7-534B-4183-8794-CEE3803436BE}.Release|x86.ActiveCfg = Release|Any CPU
+ {C8E34CC7-534B-4183-8794-CEE3803436BE}.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}
@@ -679,5 +709,10 @@ Global
{7BEA7878-B5BA-4480-BC56-2F7B836F64B9} = {56555FB0-B513-49EF-9002-A5AF135EA090}
{38FFE1DF-4B49-40C1-9908-51860BCF2D3E} = {56555FB0-B513-49EF-9002-A5AF135EA090}
{83C963FD-DC23-46E8-9545-F56197164810} = {56555FB0-B513-49EF-9002-A5AF135EA090}
+ {5524A60A-E442-43DC-B5D3-F12129B2B1DB} = {56555FB0-B513-49EF-9002-A5AF135EA090}
+ {C8E34CC7-534B-4183-8794-CEE3803436BE} = {56555FB0-B513-49EF-9002-A5AF135EA090}
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {87DB432D-BF83-4F67-A077-8E0F02BE9F55}
EndGlobalSection
EndGlobal
diff --git a/ROJEKT2/Program.cs b/ROJEKT2/Program.cs
new file mode 100644
index 00000000..9b3cb9ef
--- /dev/null
+++ b/ROJEKT2/Program.cs
@@ -0,0 +1,40 @@
+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();
+if (operacia == "/" && cislo2 == 0)
+{
+ Console.WriteLine("Chyba: Delenie nulou nie je povolene.");
+ return;
+}
+if (operacia != "+" && operacia != "-" && operacia != "*" && operacia != "/" && operacia != "%")
+{
+ Console.WriteLine("Chyba: Neplatna operacia.");
+ return;
+}
+
+decimal vysedlok = operacia switch
+{
+ "+" => (cislo1 + cislo2),
+ "-" => (cislo1 - cislo2),
+ "*" => (cislo1 * cislo2),
+ "/" => (cislo1 / cislo2),
+ "%" => (cislo1 % cislo2),
+};
+Console.WriteLine($"Vysledok je: {vysedlok}");
+Console.WriteLine("Stlac ENTER pre spustenie kalkulacky");
+Console.ReadLine();
+System.Diagnostics.Process.Start("kalkulacka.exe");
+System.Environment.Exit(0);
+
+
+
+
+// nacitam prve cslo
+//nacitam operaciu
+//nacitam druhe cislo
+//vypisem vypisem operaciu
+//vypisem vysledok
+
diff --git a/ROJEKT2/kalkulacka.csproj b/ROJEKT2/kalkulacka.csproj
new file mode 100644
index 00000000..fd4bd08d
--- /dev/null
+++ b/ROJEKT2/kalkulacka.csproj
@@ -0,0 +1,10 @@
+
+
+
+ Exe
+ net9.0
+ enable
+ enable
+
+
+
diff --git a/projekt1/Program.cs b/projekt1/Program.cs
new file mode 100644
index 00000000..d75b4508
--- /dev/null
+++ b/projekt1/Program.cs
@@ -0,0 +1,16 @@
+int a = 10;
+int b = 5;
+int plus = a + b;
+int minus = a - b;
+int krat = a * b;
+int deleno = a / b;
+int zostatok = a % b;
+bool rovnake = a == b;
+bool rozne = a != b;
+bool vacsie = a > b;
+bool mensie = a < b;
+bool vacsieRovnake = a >= b;
+bool mensieRovnake = a <= b;
+ Console.WriteLine($"{plus} {minus} {krat} {deleno} {zostatok} {rovnake} {rozne} {vacsie} { mensie} {vacsieRovnake} {mensieRovnake}");
+
+
diff --git a/projekt1/projekt1.csproj b/projekt1/projekt1.csproj
new file mode 100644
index 00000000..fd4bd08d
--- /dev/null
+++ b/projekt1/projekt1.csproj
@@ -0,0 +1,10 @@
+
+
+
+ Exe
+ net9.0
+ enable
+ enable
+
+
+
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!";
}
}
diff --git a/src/AppsLab-002-ConsoleWriteLine/Program.cs b/src/AppsLab-002-ConsoleWriteLine/Program.cs
index 837131c2..2ea10ec8 100644
--- a/src/AppsLab-002-ConsoleWriteLine/Program.cs
+++ b/src/AppsLab-002-ConsoleWriteLine/Program.cs
@@ -1 +1,4 @@
-Console.WriteLine("Hello, World!");
\ No newline at end of file
+int age = 14;
+string name= "John";
+
+Console.WriteLine($"Hello my name is {name} and i am {age} years old ");
diff --git a/src/AppsLab-005-DataTypes/AppsLab-005-DataTypes.csproj b/src/AppsLab-005-DataTypes/AppsLab-005-DataTypes.csproj
index e1693b81..bc3ec91d 100644
--- a/src/AppsLab-005-DataTypes/AppsLab-005-DataTypes.csproj
+++ b/src/AppsLab-005-DataTypes/AppsLab-005-DataTypes.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net7.0
AppsLab_005_DataTypes
enable
enable
diff --git a/src/AppsLab-005-DataTypes/Program.cs b/src/AppsLab-005-DataTypes/Program.cs
index 3751555c..f8d8bf44 100644
--- a/src/AppsLab-005-DataTypes/Program.cs
+++ b/src/AppsLab-005-DataTypes/Program.cs
@@ -1,2 +1,11 @@
-// See https://aka.ms/new-console-template for more information
-Console.WriteLine("Hello, World!");
+int cislo = 10;
+string text = "test1";
+char znak = 'a';
+bool mojahodnota = true;
+decimal test = 10.5m;
+DateTime dnesnydatum = DateTime.Now;
+int sucet = cislo + 67;
+float desatinne = 1.23f;
+var meno = "Alex";
+Console.WriteLine($"cislo JE {cislo.ToString("000")} T" +
+ $"TEXT JE {text} znak je {znak} hodnota bool je {mojahodnota} decimal je {test} dnesny datum je {dnesnydatum.ToString("yyyy-MM-dd")} sucet cisla {cislo} a 67 je : {sucet} Desatinne cislo je {desatinne} meno je {meno}");
\ No newline at end of file
diff --git a/src/AppsLab-006-Constants/Program.cs b/src/AppsLab-006-Constants/Program.cs
index 3751555c..902ad63e 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 = 100;
+const int MinAgeForDriversLicense = 17;
+const string WelcomeMessage = "Vitaj v nasej hre!";
+Console.WriteLine($"maximalny pocet bodov je {MaxPoints}");
+Console.WriteLine($"minimalny vek na vodicak je { MinAgeForDriversLicense}");
+Console.WriteLine($"welcome message je {WelcomeMessage}");
+
\ No newline at end of file
diff --git a/src/AppsLab-007-Casting/Converter.cs b/src/AppsLab-007-Casting/Converter.cs
index a64ce567..8d9ffdd5 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/src/AppsLab-008-ConsoleReadLine/AppsLab-008-ConsoleReadLine.csproj b/src/AppsLab-008-ConsoleReadLine/AppsLab-008-ConsoleReadLine.csproj
index 810698be..db1207a2 100644
--- a/src/AppsLab-008-ConsoleReadLine/AppsLab-008-ConsoleReadLine.csproj
+++ b/src/AppsLab-008-ConsoleReadLine/AppsLab-008-ConsoleReadLine.csproj
@@ -8,4 +8,8 @@
enable
+
+
+
+
diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs
index 6f7376c9..221c56e6 100644
--- a/src/AppsLab-008-ConsoleReadLine/Program.cs
+++ b/src/AppsLab-008-ConsoleReadLine/Program.cs
@@ -1,8 +1,23 @@
-Console.WriteLine("Ako sa voláš?");
-string? meno = Console.ReadLine();
-Console.WriteLine("Ahoj, " + meno);
-
-Console.WriteLine("Koľko máš rokov?");
-string vstup = Console.ReadLine() ?? "0";
-int vek = int.Parse(vstup);
-Console.WriteLine("Máš " + vek + " rokov.");
+// privitanie
+Console.WriteLine("Vitaj v kalkulacke!");
+// zadame cislo a operciu
+Console.WriteLine("Zadaj prve cislo:");
+int cislo = int.Parse(Console.ReadLine()!);
+Console.WriteLine("Zadaj druhe cislo:");
+int cislo2 = int.Parse(Console.ReadLine()!);
+Console.WriteLine("Zadaj operaciu (+, -, *, /, ):");
+string operacia = Console.ReadLine()!;
+int vysledok = operacia switch
+// zvolim operaciu a spocittamm
+{
+ "+" => cislo + cislo2,
+ "-" => cislo - cislo2,
+ "*" => cislo * cislo2,
+ "/" => cislo / cislo2,
+};
+// vypisem vysledok
+Console.WriteLine($"Vysledok je: {vysledok}");
+
+
+
+
diff --git a/src/AppsLab-009-Operators/Calculator.cs b/src/AppsLab-009-Operators/Calculator.cs
index 981993a9..43e42bc4 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,8 @@ public int Multiply(int a, int b)
///
public double Divide(int a, int b)
{
- throw new NotImplementedException();
+ return (double) a / b;
+
}
///
@@ -42,7 +43,7 @@ public double Divide(int a, int b)
///
public int Remainder(int a, int b)
{
- throw new NotImplementedException();
+ return a % b;
}
///
@@ -50,7 +51,7 @@ public int Remainder(int a, int b)
///
public bool AreEqual(int a, int b)
{
- throw new NotImplementedException();
+ return a == b;
}
///
@@ -58,7 +59,7 @@ public bool AreEqual(int a, int b)
///
public bool AreNotEqual(int a, int b)
{
- throw new NotImplementedException();
+ return a != b;
}
///
@@ -66,7 +67,7 @@ public bool AreNotEqual(int a, int b)
///
public bool IsGreater(int a, int b)
{
- throw new NotImplementedException();
+ return a > b;
}
///
@@ -74,7 +75,8 @@ public bool IsGreater(int a, int b)
///
public bool IsLesser(int a, int b)
{
- throw new NotImplementedException();
+ return a < b;
+
}
///
@@ -82,7 +84,7 @@ public bool IsLesser(int a, int b)
///
public bool IsGreaterOrEqual(int a, int b)
{
- throw new NotImplementedException();
+ return a >= b;
}
///
@@ -90,6 +92,6 @@ public bool IsGreaterOrEqual(int a, int b)
///
public bool IsLesserOrEqual(int a, int b)
{
- throw new NotImplementedException();
+ return a <= b;
}
}
diff --git a/src/AppsLab-009-Operators/Program.cs b/src/AppsLab-009-Operators/Program.cs
new file mode 100644
index 00000000..221c56e6
--- /dev/null
+++ b/src/AppsLab-009-Operators/Program.cs
@@ -0,0 +1,23 @@
+// privitanie
+Console.WriteLine("Vitaj v kalkulacke!");
+// zadame cislo a operciu
+Console.WriteLine("Zadaj prve cislo:");
+int cislo = int.Parse(Console.ReadLine()!);
+Console.WriteLine("Zadaj druhe cislo:");
+int cislo2 = int.Parse(Console.ReadLine()!);
+Console.WriteLine("Zadaj operaciu (+, -, *, /, ):");
+string operacia = Console.ReadLine()!;
+int vysledok = operacia switch
+// zvolim operaciu a spocittamm
+{
+ "+" => cislo + cislo2,
+ "-" => cislo - cislo2,
+ "*" => cislo * cislo2,
+ "/" => cislo / cislo2,
+};
+// vypisem vysledok
+Console.WriteLine($"Vysledok je: {vysledok}");
+
+
+
+
diff --git a/src/AppsLab-010-Math/SphereCalculator.cs b/src/AppsLab-010-Math/SphereCalculator.cs
index d0874433..ed83f614 100644
--- a/src/AppsLab-010-Math/SphereCalculator.cs
+++ b/src/AppsLab-010-Math/SphereCalculator.cs
@@ -12,7 +12,9 @@ public class SphereCalculator
/// The surface area of the sphere.
public double CalculateSurface(double radius)
{
- throw new NotImplementedException();
+ return 4 * Math.PI * Math.Pow(radius, 2);
+ // styri krat pi krat r na druhu
+
}
///
@@ -22,6 +24,8 @@ public double CalculateSurface(double radius)
/// The volume of the sphere.
public double CalculateVolume(double radius)
{
- throw new NotImplementedException();
+ return (4.0 / 3.0) * Math.PI * Math.Pow(radius, 3);
+ // styri trtiny krat pi krat r na tretiu
+
}
}
diff --git a/src/AppsLab-011-Strings/AppsLab-011-Strings.csproj b/src/AppsLab-011-Strings/AppsLab-011-Strings.csproj
index b211a418..ebc28c42 100644
--- a/src/AppsLab-011-Strings/AppsLab-011-Strings.csproj
+++ b/src/AppsLab-011-Strings/AppsLab-011-Strings.csproj
@@ -7,4 +7,8 @@
enable
+
+
+
+
diff --git a/src/AppsLab-011-Strings/StringManipulator.cs b/src/AppsLab-011-Strings/StringManipulator.cs
index f226d70d..779bf3be 100644
--- a/src/AppsLab-011-Strings/StringManipulator.cs
+++ b/src/AppsLab-011-Strings/StringManipulator.cs
@@ -13,7 +13,7 @@ public class StringManipulator
/// The concatenated string.
public string AppendStrings(string first, string second)
{
- throw new NotImplementedException();
+ return first + second;
}
///
@@ -23,7 +23,7 @@ public string AppendStrings(string first, string second)
/// The uppercase string.
public string ConvertToUpper(string input)
{
- throw new NotImplementedException();
+ return input.ToUpper();
}
///
@@ -33,7 +33,7 @@ public string ConvertToUpper(string input)
/// The lowercase string.
public string ConvertToLower(string input)
{
- throw new NotImplementedException();
+ return input.ToLower();
}
///
@@ -44,7 +44,7 @@ public string ConvertToLower(string input)
/// True if the substring is found, false otherwise.
public bool ContainsSubstring(string input, string substring)
{
- throw new NotImplementedException();
+ return input.Contains(substring);
}
///
@@ -55,6 +55,6 @@ public bool ContainsSubstring(string input, string substring)
/// True if the string starts with the substring, false otherwise.
public bool StartsWithSubstring(string input, string substring)
{
- throw new NotImplementedException();
+ return input.StartsWith(substring);
}
}
\ No newline at end of file
diff --git a/src/AppsLab-012-Boolean/BooleanLogic.cs b/src/AppsLab-012-Boolean/BooleanLogic.cs
index b71c40ad..06a17951 100644
--- a/src/AppsLab-012-Boolean/BooleanLogic.cs
+++ b/src/AppsLab-012-Boolean/BooleanLogic.cs
@@ -13,7 +13,7 @@ public class BooleanLogic
/// The result of the logical AND operation.
public bool And(bool a, bool b)
{
- throw new NotImplementedException();
+ return (a && b);
}
///
@@ -24,7 +24,7 @@ public bool And(bool a, bool b)
/// The result of the logical OR operation.
public bool Or(bool a, bool b)
{
- throw new NotImplementedException();
+ return (a || b);
}
///
@@ -34,6 +34,6 @@ public bool Or(bool a, bool b)
/// The result of the logical NOT operation.
public bool Not(bool a)
{
- throw new NotImplementedException();
+ return (!a);
}
}
\ No newline at end of file
diff --git a/src/AppsLab-013-Conditions/GameRules.cs b/src/AppsLab-013-Conditions/GameRules.cs
index 4a0ead73..419553fd 100644
--- a/src/AppsLab-013-Conditions/GameRules.cs
+++ b/src/AppsLab-013-Conditions/GameRules.cs
@@ -13,7 +13,7 @@ public class GameRules
/// True if the player can enter the game, false otherwise.
public bool CanPlayerEnterGame(string playerName, int playerAge)
{
- throw new NotImplementedException();
+ return (!string.IsNullOrEmpty(playerName) && playerAge >= 18);
}
///
@@ -23,7 +23,7 @@ public bool CanPlayerEnterGame(string playerName, int playerAge)
/// True if the game is over, false otherwise.
public bool IsGameOver(int playerHealth)
{
- throw new NotImplementedException();
+ return (playerHealth <= 0);
}
///
@@ -34,6 +34,6 @@ public bool IsGameOver(int playerHealth)
/// True if the secret door should be opened, false otherwise.
public bool ShouldOpenSecretDoor(bool hasKey, bool knowsPassword)
{
- throw new NotImplementedException();
+ return (hasKey && knowsPassword);
}
}
\ No newline at end of file
diff --git a/src/AppsLab-014-Switch/MovieRating.cs b/src/AppsLab-014-Switch/MovieRating.cs
index ab689d49..3f0f351e 100644
--- a/src/AppsLab-014-Switch/MovieRating.cs
+++ b/src/AppsLab-014-Switch/MovieRating.cs
@@ -12,6 +12,14 @@ public class MovieRating
/// A string describing the specified movie rating.
public string GetRatingDescription(int rating)
{
- throw new NotImplementedException();
+ return rating switch
+ {
+ 1 => "Veľmi zlý",
+ 2 => "Zlý",
+ 3 => "Priemerný",
+ 4 => "Dobrý",
+ 5 => "Výborný",
+ _ => "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..988f1ccd 100644
--- a/src/AppsLab-015-Arrays/ArrayProcessor.cs
+++ b/src/AppsLab-015-Arrays/ArrayProcessor.cs
@@ -13,7 +13,15 @@ public class ArrayProcessor
/// First element of the array, or 0 if array is empty.
public int GetFirstElement(int[] numbers)
{
- throw new NotImplementedException();
+ if (numbers == null || numbers.Length == 0)
+ //ak je pole null alebo prazdne
+
+ {
+ return 0;
+ // vrat 0
+ }
+ return numbers[0];
+ // vrat prvy prvok pola
}
///
@@ -23,8 +31,13 @@ public int GetFirstElement(int[] numbers)
/// Array of integers.
/// Last element of the array, or 0 if array is empty.
public int GetLastElement(int[] numbers)
+
{
- throw new NotImplementedException();
+ if (numbers == null|| numbers.Length == 0)
+ {
+ return 0;
+ }
+ return numbers[numbers.Length - 1];
}
///
@@ -36,7 +49,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 ||
+ numbers == null || numbers.Length == 0)
+ {
+ return 0;
+ }
+ return numbers[position];
}
///
@@ -46,6 +64,6 @@ public int GetElementAtPosition(int[] numbers, int position)
/// Length of the array.
public int GetLength(int[] numbers)
{
- throw new NotImplementedException();
+ return numbers.Length;
}
}
diff --git a/src/AppsLab-016-Loops/WeatherStats.cs b/src/AppsLab-016-Loops/WeatherStats.cs
index 8bca9659..87775d7d 100644
--- a/src/AppsLab-016-Loops/WeatherStats.cs
+++ b/src/AppsLab-016-Loops/WeatherStats.cs
@@ -1,4 +1,6 @@
-namespace AppsLab_016_Loops;
+using System.Security.Cryptography;
+
+namespace AppsLab_016_Loops;
///
/// Class to calculate weather statistics.
@@ -12,17 +14,17 @@ public class WeatherStats
/// Average temperature.
public double AverageTemperature(double[] temperatures)
{
- throw new NotImplementedException();
+ return temperatures.Length == 0 ? 0 : temperatures.Sum() / temperatures.Length;
}
///
/// Find the maximum temperature from the provided values.
///
- /// Array of temperatures.
+ /// Array of temperatures.x
/// Maximum temperature.
public double MaxTemperature(double[] temperatures)
{
- throw new NotImplementedException();
+ return
}
///
diff --git a/test/Program.cs b/test/Program.cs
new file mode 100644
index 00000000..f2b127a7
--- /dev/null
+++ b/test/Program.cs
@@ -0,0 +1,16 @@
+
+string[] names = new string[] {"Jozef", "Marek", "Anna", "Eva", "Peter"};
+string[,] matrix = new string[30,5];
+matrix [0,2] = "Jozef";
+matrix [1,2] = "Marek";
+matrix [2,2] = "Anna";
+matrix [25,2] = "Eva";
+for (int i = 0; i < 30; i++)
+{
+ for (int j = 0; j < 5; j++)
+ {
+
+ Console.Write(matrix[i, j ] + " ,");
+ }
+ Console.WriteLine();
+}
diff --git a/test/test.csproj b/test/test.csproj
new file mode 100644
index 00000000..15a37357
--- /dev/null
+++ b/test/test.csproj
@@ -0,0 +1,10 @@
+
+
+
+ Exe
+ net7.0
+ enable
+ enable
+
+
+
diff --git a/tests/AppsLab-007-Casting.Tests/ConverterTests.cs b/tests/AppsLab-007-Casting.Tests/ConverterTests.cs
index e9d8642c..76c5605f 100644
--- a/tests/AppsLab-007-Casting.Tests/ConverterTests.cs
+++ b/tests/AppsLab-007-Casting.Tests/ConverterTests.cs
@@ -20,8 +20,8 @@ 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]