diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 58bbf6b5..1f10c2a4 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -93,10 +93,25 @@ 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}") = "projekt1", "projekt1\projekt1.csproj", "{5D133EF7-104A-4218-ACC7-17E45C2E9585}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "projekt2", "projekt2\projekt2.csproj", "{CE44069A-983B-468A-B7B0-CA9B76C7540C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kalkulacka", "Kalkulacka\Kalkulacka.csproj", "{9EEF9340-3CB6-4B9D-90A4-1926493F0C4F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kalkulackaa", "Kalkulackaa\Kalkulackaa.csproj", "{ED059B73-649D-4B78-943D-A3B6A933706C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "monday", "monday\monday.csproj", "{938BFD03-B71D-4EEE-AAAE-0F8DB54874AA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pisanie", "pisanie\pisanie.csproj", "{0D1CC3A9-06C4-486D-8D6C-CC9183B52D25}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OOP", "OOP\OOP.csproj", "{E09184B7-D2D9-49BF-A3A2-783D16D6D1AD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "simulacia", "simulacia\simulacia.csproj", "{965455C6-CD04-461B-BECB-0B3B4BA380B8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "student", "student\student.csproj", "{7418BCB7-9369-4722-A8A6-A1A639AEE8E0}" +EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -226,18 +241,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 +637,117 @@ 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 + {5D133EF7-104A-4218-ACC7-17E45C2E9585}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5D133EF7-104A-4218-ACC7-17E45C2E9585}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5D133EF7-104A-4218-ACC7-17E45C2E9585}.Debug|x64.ActiveCfg = Debug|Any CPU + {5D133EF7-104A-4218-ACC7-17E45C2E9585}.Debug|x64.Build.0 = Debug|Any CPU + {5D133EF7-104A-4218-ACC7-17E45C2E9585}.Debug|x86.ActiveCfg = Debug|Any CPU + {5D133EF7-104A-4218-ACC7-17E45C2E9585}.Debug|x86.Build.0 = Debug|Any CPU + {5D133EF7-104A-4218-ACC7-17E45C2E9585}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5D133EF7-104A-4218-ACC7-17E45C2E9585}.Release|Any CPU.Build.0 = Release|Any CPU + {5D133EF7-104A-4218-ACC7-17E45C2E9585}.Release|x64.ActiveCfg = Release|Any CPU + {5D133EF7-104A-4218-ACC7-17E45C2E9585}.Release|x64.Build.0 = Release|Any CPU + {5D133EF7-104A-4218-ACC7-17E45C2E9585}.Release|x86.ActiveCfg = Release|Any CPU + {5D133EF7-104A-4218-ACC7-17E45C2E9585}.Release|x86.Build.0 = Release|Any CPU + {CE44069A-983B-468A-B7B0-CA9B76C7540C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CE44069A-983B-468A-B7B0-CA9B76C7540C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CE44069A-983B-468A-B7B0-CA9B76C7540C}.Debug|x64.ActiveCfg = Debug|Any CPU + {CE44069A-983B-468A-B7B0-CA9B76C7540C}.Debug|x64.Build.0 = Debug|Any CPU + {CE44069A-983B-468A-B7B0-CA9B76C7540C}.Debug|x86.ActiveCfg = Debug|Any CPU + {CE44069A-983B-468A-B7B0-CA9B76C7540C}.Debug|x86.Build.0 = Debug|Any CPU + {CE44069A-983B-468A-B7B0-CA9B76C7540C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CE44069A-983B-468A-B7B0-CA9B76C7540C}.Release|Any CPU.Build.0 = Release|Any CPU + {CE44069A-983B-468A-B7B0-CA9B76C7540C}.Release|x64.ActiveCfg = Release|Any CPU + {CE44069A-983B-468A-B7B0-CA9B76C7540C}.Release|x64.Build.0 = Release|Any CPU + {CE44069A-983B-468A-B7B0-CA9B76C7540C}.Release|x86.ActiveCfg = Release|Any CPU + {CE44069A-983B-468A-B7B0-CA9B76C7540C}.Release|x86.Build.0 = Release|Any CPU + {9EEF9340-3CB6-4B9D-90A4-1926493F0C4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9EEF9340-3CB6-4B9D-90A4-1926493F0C4F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9EEF9340-3CB6-4B9D-90A4-1926493F0C4F}.Debug|x64.ActiveCfg = Debug|Any CPU + {9EEF9340-3CB6-4B9D-90A4-1926493F0C4F}.Debug|x64.Build.0 = Debug|Any CPU + {9EEF9340-3CB6-4B9D-90A4-1926493F0C4F}.Debug|x86.ActiveCfg = Debug|Any CPU + {9EEF9340-3CB6-4B9D-90A4-1926493F0C4F}.Debug|x86.Build.0 = Debug|Any CPU + {9EEF9340-3CB6-4B9D-90A4-1926493F0C4F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9EEF9340-3CB6-4B9D-90A4-1926493F0C4F}.Release|Any CPU.Build.0 = Release|Any CPU + {9EEF9340-3CB6-4B9D-90A4-1926493F0C4F}.Release|x64.ActiveCfg = Release|Any CPU + {9EEF9340-3CB6-4B9D-90A4-1926493F0C4F}.Release|x64.Build.0 = Release|Any CPU + {9EEF9340-3CB6-4B9D-90A4-1926493F0C4F}.Release|x86.ActiveCfg = Release|Any CPU + {9EEF9340-3CB6-4B9D-90A4-1926493F0C4F}.Release|x86.Build.0 = Release|Any CPU + {ED059B73-649D-4B78-943D-A3B6A933706C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED059B73-649D-4B78-943D-A3B6A933706C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED059B73-649D-4B78-943D-A3B6A933706C}.Debug|x64.ActiveCfg = Debug|Any CPU + {ED059B73-649D-4B78-943D-A3B6A933706C}.Debug|x64.Build.0 = Debug|Any CPU + {ED059B73-649D-4B78-943D-A3B6A933706C}.Debug|x86.ActiveCfg = Debug|Any CPU + {ED059B73-649D-4B78-943D-A3B6A933706C}.Debug|x86.Build.0 = Debug|Any CPU + {ED059B73-649D-4B78-943D-A3B6A933706C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED059B73-649D-4B78-943D-A3B6A933706C}.Release|Any CPU.Build.0 = Release|Any CPU + {ED059B73-649D-4B78-943D-A3B6A933706C}.Release|x64.ActiveCfg = Release|Any CPU + {ED059B73-649D-4B78-943D-A3B6A933706C}.Release|x64.Build.0 = Release|Any CPU + {ED059B73-649D-4B78-943D-A3B6A933706C}.Release|x86.ActiveCfg = Release|Any CPU + {ED059B73-649D-4B78-943D-A3B6A933706C}.Release|x86.Build.0 = Release|Any CPU + {938BFD03-B71D-4EEE-AAAE-0F8DB54874AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {938BFD03-B71D-4EEE-AAAE-0F8DB54874AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {938BFD03-B71D-4EEE-AAAE-0F8DB54874AA}.Debug|x64.ActiveCfg = Debug|Any CPU + {938BFD03-B71D-4EEE-AAAE-0F8DB54874AA}.Debug|x64.Build.0 = Debug|Any CPU + {938BFD03-B71D-4EEE-AAAE-0F8DB54874AA}.Debug|x86.ActiveCfg = Debug|Any CPU + {938BFD03-B71D-4EEE-AAAE-0F8DB54874AA}.Debug|x86.Build.0 = Debug|Any CPU + {938BFD03-B71D-4EEE-AAAE-0F8DB54874AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {938BFD03-B71D-4EEE-AAAE-0F8DB54874AA}.Release|Any CPU.Build.0 = Release|Any CPU + {938BFD03-B71D-4EEE-AAAE-0F8DB54874AA}.Release|x64.ActiveCfg = Release|Any CPU + {938BFD03-B71D-4EEE-AAAE-0F8DB54874AA}.Release|x64.Build.0 = Release|Any CPU + {938BFD03-B71D-4EEE-AAAE-0F8DB54874AA}.Release|x86.ActiveCfg = Release|Any CPU + {938BFD03-B71D-4EEE-AAAE-0F8DB54874AA}.Release|x86.Build.0 = Release|Any CPU + {0D1CC3A9-06C4-486D-8D6C-CC9183B52D25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0D1CC3A9-06C4-486D-8D6C-CC9183B52D25}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0D1CC3A9-06C4-486D-8D6C-CC9183B52D25}.Debug|x64.ActiveCfg = Debug|Any CPU + {0D1CC3A9-06C4-486D-8D6C-CC9183B52D25}.Debug|x64.Build.0 = Debug|Any CPU + {0D1CC3A9-06C4-486D-8D6C-CC9183B52D25}.Debug|x86.ActiveCfg = Debug|Any CPU + {0D1CC3A9-06C4-486D-8D6C-CC9183B52D25}.Debug|x86.Build.0 = Debug|Any CPU + {0D1CC3A9-06C4-486D-8D6C-CC9183B52D25}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0D1CC3A9-06C4-486D-8D6C-CC9183B52D25}.Release|Any CPU.Build.0 = Release|Any CPU + {0D1CC3A9-06C4-486D-8D6C-CC9183B52D25}.Release|x64.ActiveCfg = Release|Any CPU + {0D1CC3A9-06C4-486D-8D6C-CC9183B52D25}.Release|x64.Build.0 = Release|Any CPU + {0D1CC3A9-06C4-486D-8D6C-CC9183B52D25}.Release|x86.ActiveCfg = Release|Any CPU + {0D1CC3A9-06C4-486D-8D6C-CC9183B52D25}.Release|x86.Build.0 = Release|Any CPU + {E09184B7-D2D9-49BF-A3A2-783D16D6D1AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E09184B7-D2D9-49BF-A3A2-783D16D6D1AD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E09184B7-D2D9-49BF-A3A2-783D16D6D1AD}.Debug|x64.ActiveCfg = Debug|Any CPU + {E09184B7-D2D9-49BF-A3A2-783D16D6D1AD}.Debug|x64.Build.0 = Debug|Any CPU + {E09184B7-D2D9-49BF-A3A2-783D16D6D1AD}.Debug|x86.ActiveCfg = Debug|Any CPU + {E09184B7-D2D9-49BF-A3A2-783D16D6D1AD}.Debug|x86.Build.0 = Debug|Any CPU + {E09184B7-D2D9-49BF-A3A2-783D16D6D1AD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E09184B7-D2D9-49BF-A3A2-783D16D6D1AD}.Release|Any CPU.Build.0 = Release|Any CPU + {E09184B7-D2D9-49BF-A3A2-783D16D6D1AD}.Release|x64.ActiveCfg = Release|Any CPU + {E09184B7-D2D9-49BF-A3A2-783D16D6D1AD}.Release|x64.Build.0 = Release|Any CPU + {E09184B7-D2D9-49BF-A3A2-783D16D6D1AD}.Release|x86.ActiveCfg = Release|Any CPU + {E09184B7-D2D9-49BF-A3A2-783D16D6D1AD}.Release|x86.Build.0 = Release|Any CPU + {965455C6-CD04-461B-BECB-0B3B4BA380B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {965455C6-CD04-461B-BECB-0B3B4BA380B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {965455C6-CD04-461B-BECB-0B3B4BA380B8}.Debug|x64.ActiveCfg = Debug|Any CPU + {965455C6-CD04-461B-BECB-0B3B4BA380B8}.Debug|x64.Build.0 = Debug|Any CPU + {965455C6-CD04-461B-BECB-0B3B4BA380B8}.Debug|x86.ActiveCfg = Debug|Any CPU + {965455C6-CD04-461B-BECB-0B3B4BA380B8}.Debug|x86.Build.0 = Debug|Any CPU + {965455C6-CD04-461B-BECB-0B3B4BA380B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {965455C6-CD04-461B-BECB-0B3B4BA380B8}.Release|Any CPU.Build.0 = Release|Any CPU + {965455C6-CD04-461B-BECB-0B3B4BA380B8}.Release|x64.ActiveCfg = Release|Any CPU + {965455C6-CD04-461B-BECB-0B3B4BA380B8}.Release|x64.Build.0 = Release|Any CPU + {965455C6-CD04-461B-BECB-0B3B4BA380B8}.Release|x86.ActiveCfg = Release|Any CPU + {965455C6-CD04-461B-BECB-0B3B4BA380B8}.Release|x86.Build.0 = Release|Any CPU + {7418BCB7-9369-4722-A8A6-A1A639AEE8E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7418BCB7-9369-4722-A8A6-A1A639AEE8E0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7418BCB7-9369-4722-A8A6-A1A639AEE8E0}.Debug|x64.ActiveCfg = Debug|Any CPU + {7418BCB7-9369-4722-A8A6-A1A639AEE8E0}.Debug|x64.Build.0 = Debug|Any CPU + {7418BCB7-9369-4722-A8A6-A1A639AEE8E0}.Debug|x86.ActiveCfg = Debug|Any CPU + {7418BCB7-9369-4722-A8A6-A1A639AEE8E0}.Debug|x86.Build.0 = Debug|Any CPU + {7418BCB7-9369-4722-A8A6-A1A639AEE8E0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7418BCB7-9369-4722-A8A6-A1A639AEE8E0}.Release|Any CPU.Build.0 = Release|Any CPU + {7418BCB7-9369-4722-A8A6-A1A639AEE8E0}.Release|x64.ActiveCfg = Release|Any CPU + {7418BCB7-9369-4722-A8A6-A1A639AEE8E0}.Release|x64.Build.0 = Release|Any CPU + {7418BCB7-9369-4722-A8A6-A1A639AEE8E0}.Release|x86.ActiveCfg = Release|Any CPU + {7418BCB7-9369-4722-A8A6-A1A639AEE8E0}.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 +793,13 @@ 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} + {ED059B73-649D-4B78-943D-A3B6A933706C} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {0D1CC3A9-06C4-486D-8D6C-CC9183B52D25} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {E09184B7-D2D9-49BF-A3A2-783D16D6D1AD} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {965455C6-CD04-461B-BECB-0B3B4BA380B8} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {7418BCB7-9369-4722-A8A6-A1A639AEE8E0} = {56555FB0-B513-49EF-9002-A5AF135EA090} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {35C183AD-8455-4668-A0C5-0134A189807B} EndGlobalSection EndGlobal diff --git a/Kalkulacka/Kalkulacka.csproj b/Kalkulacka/Kalkulacka.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/Kalkulacka/Kalkulacka.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/Kalkulacka/Program.cs b/Kalkulacka/Program.cs new file mode 100644 index 00000000..c3389906 --- /dev/null +++ b/Kalkulacka/Program.cs @@ -0,0 +1,19 @@ +//int i = 1; +//while (i <= 1000) +//{ +// Console.WriteLine(i); +// i++; +//} + +using System.ComponentModel.Design; +using System.Numerics; + +for (int i = 1; i <= 1000; i++) +{ + int modulo = i % 2; + if (modulo == 0) + { + Console.WriteLine(i); + } +} + diff --git a/Kalkulackaa/Kalkulackaa.csproj b/Kalkulackaa/Kalkulackaa.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/Kalkulackaa/Kalkulackaa.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/Kalkulackaa/Program.cs b/Kalkulackaa/Program.cs new file mode 100644 index 00000000..22a6619b --- /dev/null +++ b/Kalkulackaa/Program.cs @@ -0,0 +1,62 @@ +ConsoleColor consoleColor = ConsoleColor.DarkGray; +Console.BackgroundColor = consoleColor; +Console.Clear(); +Console.ForegroundColor = ConsoleColor.Black; +System.Console.Title = "Kalkulacka v0.1 by Patrik"; + + + + + + + +//nacitam prve cislo +//nacitam druhe cislo +//nacitam operaciu +//vypisem vysledok +Console.WriteLine("Vitaj v kalkulacke"); +Console.WriteLine("Zadaj prve cislo"); +double prveCislo = double.Parse(Console.ReadLine()); +Console.WriteLine("Zadaj druhe cislo"); +double druheCislo = double.Parse(Console.ReadLine()); +Console.WriteLine("Zadaj operaciu (+, -, *, /)"); +string operacia = Console.ReadLine(); +double vysledok = 0; + +if (operacia == "-") +{ + vysledok = prveCislo - druheCislo; +} +else if (operacia == "+") +{ + vysledok = prveCislo + druheCislo; +} +else if (operacia == "*") +{ + vysledok = prveCislo * druheCislo; +} +else if (operacia == "/") +{ + if (druheCislo != 0) + { + vysledok = prveCislo / druheCislo; + } + else + { + Console.WriteLine("SynTax EROR : nulou sa neda delit"); + return; // Ukonci program, aby sa nevypisal nespravny vysledok + } +} +else +{ + Console.WriteLine("Chyba: neplatna operacia."); + return; // Ukonci program, aby sa nevypisal nespravny vysledok +} +Console.WriteLine($"Tvoj v7sledok je : {vysledok}"); + +Console.WriteLine("Pre reset programu strac ENTER"); +Console.ReadLine(); +System.Diagnostics.Process.Start("Kalkulackaa.exe"); +Environment.Exit(0); + + diff --git a/OOP/Monster.cs b/OOP/Monster.cs new file mode 100644 index 00000000..19276f0e --- /dev/null +++ b/OOP/Monster.cs @@ -0,0 +1,27 @@ + +using System.Runtime.CompilerServices; + +namespace OOP +{ + public class Monster + { + private const int maxHP = 200; + private const int minHP = 0; + private int currentHP = maxHP; + private int damage = 1; + public int damageHit = 15; + + public void TakeDamage(int damageHit) + { + currentHP -= damageHit; + } + public bool GiveDamage(Player opponent) + { + opponent.TakeDamage(damageHit); + return true; + + } + + } +} + diff --git a/OOP/OOP.csproj b/OOP/OOP.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/OOP/OOP.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/OOP/Player.cs b/OOP/Player.cs new file mode 100644 index 00000000..68216a71 --- /dev/null +++ b/OOP/Player.cs @@ -0,0 +1,29 @@ + +namespace OOP +{ + public class Player + { + private string PlayerName; + private const int maxHP = 100; + private const int minHP = 0; + private int currentHP =maxHP; + private int damage = 20; + List inventory = new List(); + + public bool DealDamage(Monster opponent) + { + opponent.TakeDamage(damage); + return true; + + } + public void TakeDamage(int damage) + { + currentHP -= damage; + } + + internal void setName(string? playerName) + { + PlayerName = playerName; + } + } +} diff --git a/OOP/Program.cs b/OOP/Program.cs new file mode 100644 index 00000000..2c53115b --- /dev/null +++ b/OOP/Program.cs @@ -0,0 +1,16 @@ +using OOP; + +string PlayerName = Console.ReadLine(); + + +Player player = new Player(); +player.setName(PlayerName); + +Monster monster = new Monster(); + + +player.DealDamage(monster); + +monster.GiveDamage(player); + +Console.WriteLine(PlayerName); diff --git a/monday/Program.cs b/monday/Program.cs new file mode 100644 index 00000000..ebaf3889 --- /dev/null +++ b/monday/Program.cs @@ -0,0 +1,46 @@ +Console.WriteLine("Zadaj cislo od 1 do 7"); +int dayOfWeek = int.Parse(Console.ReadLine()); + + + + +{ + switch (dayOfWeek) + { + case 1: + Console.WriteLine("Monday"); + break; + case 2: + Console.WriteLine("Tuesday"); + break; + case 3: + Console.WriteLine("Wednesday"); + break; + case 4: + Console.WriteLine("Thursday"); + break; + case 5: + Console.WriteLine("Friday"); + break; + case 6: + Console.WriteLine("Saturday"); + break; + case 7: + Console.WriteLine("Sunday"); + break; + default: + Console.WriteLine("Error: Invalid day of the week."); + break; + + } +} + +int number = 3; +string result = number switch +{ + 1 => "One", + 2 => "Two", + 3 => "Three", + _ => "Other" +}; +Console.WriteLine(result); diff --git a/monday/monday.csproj b/monday/monday.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/monday/monday.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/pisanie/Program.cs b/pisanie/Program.cs new file mode 100644 index 00000000..9271c11d --- /dev/null +++ b/pisanie/Program.cs @@ -0,0 +1,1066 @@ +Console.BackgroundColor = ConsoleColor.DarkCyan; +Console.Clear(); + + +Console.WriteLine("Zadajte text"); +string input = Console.ReadLine(); +string output = ""; + + + + + + +foreach (char letter in input) +{ + output = output + GetLetter(letter.ToString()); +} + +string[,] matrix = new string[50, 500]; +int offset = 0; + +foreach (char intputletter in input) +{ + string outLetter = GetLetter(intputletter.ToString()); + string[] lines = outLetter.Split(Environment.NewLine); + int letterWidth = 0; + for (int i = 0; i < lines.Length; i++) + { + string character = lines[i]; + letterWidth = Math.Max(lines[i].Length, letterWidth); + for (int j = 0; j < character.Length; j++) + { + matrix[i, j + offset] = character[j].ToString(); + } + } + offset = offset + letterWidth; +} +for (int i = 0; i < matrix.GetLength(0); i++) +{ + for (int j = 0; j < matrix.GetLength(1); j++) + { + Console.Write(matrix[i, j]); + } + Console.WriteLine(); +} + + + + + +string GetLetter(string imput) +{ + switch (imput) + { + + case "A": + case "a": + return GetLetterA(); + + + + case "B": + case "b": + return GetLetterB(); + + + case "C": + case "c": + return GetLetterC(); + + + case "D": + case "d": + return GetLetterD(); + + case "E": + case "e": + return GetLetterE(); + + case "F": + case "f": + return GetLetterF(); + + case "G": + case "g": + return GetLetterG(); + + case "H": + case "h": + return GetLetterH(); + + case "I": + case "i": + return GetLetterI(); + + case "J": + case "j": + return GetLetterJ(); + + case "K": + case "k": + return GetLetterK(); + + case "L": + case "l": + return GetLetterL(); + + case "M": + case "m": + return GetLetterM(); + + case "N": + case "n": + return GetLetterN(); + + case "O": + case "o": + return GetLetterO(); + + case "P": + case "p": + return GetLetterP(); + + case "R": + case "r": + return GetLetterR(); + + case "S": + case "s": + return GetLetterS(); + + case "T": + case "t": + return GetLetterT(); + + case "U": + case "u": + return GetLetterU(); + + case "V": + case "v": + return GetLetterV(); + + case "X": + case "x": + return GetLetterX(); + + case "Y": + case "y": + return GetLetterY(); + + case "Z": + case "z": + return GetLetterZ(); + + case "1": + return GetLetter1(); + + case "2": + return GetLetter2(); + + case "3": + return GetLetter3(); + + case "4": + return GetLetter4(); + + case "5": + return GetLetter5(); + + case "6": + return GetLetter6(); + + case "7": + return GetLetter7(); + + case "8": + return GetLetter8(); + + case "9": + return GetLetter9(); + + case "0": + return GetLetter0(); + case "w": + case "W": + return GetLetterW(); + default: + return "Pismeno nepodporovane"; + + } +} + + + + string GetLetterA() + { + return @" + + + AAA + A:::A + A:::::A + A:::::::A + A:::::::::A + A:::::A:::::A + A:::::A A:::::A + A:::::A A:::::A + A:::::A A:::::A + A:::::AAAAAAAAA:::::A + A:::::::::::::::::::::A + A:::::AAAAAAAAAAAAA:::::A + A:::::A A:::::A + A:::::A A:::::A + A:::::A A:::::A +AAAAAAA AAAAAAA +"; + } + + + + string GetLetterB() + { + return @" + + +BBBBBBBBBBBBBBBBB +B::::::::::::::::B +B::::::BBBBBB:::::B +BB:::::B B:::::B + B::::B B:::::B + B::::B B:::::B + B::::BBBBBB:::::B + B:::::::::::::BB + B::::BBBBBB:::::B + B::::B B:::::B + B::::B B:::::B + B::::B B:::::B +BB:::::BBBBBB::::::B +B:::::::::::::::::B +B::::::::::::::::B +BBBBBBBBBBBBBBBBB +"; + } + + + +string GetLetterC() +{ + return @" + + + + CCCCCCCCCCCCC + CCC::::::::::::C + CC:::::::::::::::C + C:::::CCCCCCCC::::C + C:::::C CCCCCC +C:::::C +C:::::C +C:::::C +C:::::C +C:::::C +C:::::C + C:::::C CCCCCC + C:::::CCCCCCCC::::C + CC:::::::::::::::C + CCC::::::::::::C + CCCCCCCCCCCCC + +"; +} +string GetLetterD() +{ + return @" + +DDDDDDDDDDDDD +D::::::::::::DDD +D:::::::::::::::DD +DDD:::::DDDDD:::::D + D:::::D D:::::D + D:::::D D:::::D + D:::::D D:::::D + D:::::D D:::::D + D:::::D D:::::D + D:::::D D:::::D + D:::::D D:::::D + D:::::D D:::::D +DDD:::::DDDDD:::::D +D:::::::::::::::DD +D::::::::::::DDD +DDDDDDDDDDDDD +"; +} +string GetLetterE() +{ + return @" + + + +EEEEEEEEEEEEEEEEEEEEEE +E::::::::::::::::::::E +E::::::::::::::::::::E +EE::::::EEEEEEEEE::::E + E:::::E EEEEEE + E:::::E + E::::::EEEEEEEEEE + E:::::::::::::::E + E:::::::::::::::E + E::::::EEEEEEEEEE + E:::::E + E:::::E EEEEEE +EE::::::EEEEEEEE:::::E +E::::::::::::::::::::E +E::::::::::::::::::::E +EEEEEEEEEEEEEEEEEEEEEE + +"; +} +string GetLetterF() +{ + return @" + + +FFFFFFFFFFFFFFFFFFFFFF +F::::::::::::::::::::F +F::::::::::::::::::::F +FF::::::FFFFFFFFF::::F + F:::::F FFFFFF + F:::::F + F::::::FFFFFFFFFF + F:::::::::::::::F + F:::::::::::::::F + F::::::FFFFFFFFFF + F:::::F + F:::::F +FF:::::::FF +F::::::::FF +F::::::::FF +FFFFFFFFFFF + +"; +} +string GetLetterG() +{ + return @" + + + + GGGGGGGGGGGGG + GGG::::::::::::G + GG:::::::::::::::G + G:::::GGGGGGGG::::G + G:::::G GGGGGG +G:::::G +G:::::G +G:::::G GGGGGGGGGG +G:::::G G::::::::G +G:::::G GGGGG::::G +G:::::G G::::G + G:::::G G::::G + G:::::GGGGGGGG::::G + GG:::::::::::::::G + GGG::::::GGG:::G + GGGGGG GGGG + +"; +} +string GetLetterH() +{ + return @" + + +HHHHHHHHH HHHHHHHHH +H:::::::H H:::::::H +H:::::::H H:::::::H +HH::::::H H::::::HH + H:::::H H:::::H + H:::::H H:::::H + H::::::HHHHH::::::H + H:::::::::::::::::H + H:::::::::::::::::H + H::::::HHHHH::::::H + H:::::H H:::::H + H:::::H H:::::H +HH::::::H H::::::HH +H:::::::H H:::::::H +H:::::::H H:::::::H +HHHHHHHHH HHHHHHHHH + + +"; +} +string GetLetterI() +{ + return @" + +IIIIIIIIII +I::::::::I +I::::::::I +II::::::II + I::::I + I::::I + I::::I + I::::I + I::::I + I::::I + I::::I + I::::I +II::::::II +I::::::::I +I::::::::I +IIIIIIIIII + +"; +} +string GetLetterJ() +{ + return @" + + JJJJJJJJJJJ + J:::::::::J + J:::::::::J + JJ:::::::JJ + J:::::J + J:::::J + J:::::J + J:::::j + J:::::J +JJJJJJJ J:::::J +J:::::J J:::::J +J::::::J J::::::J +J:::::::JJJ:::::::J + JJ:::::::::::::JJ + JJ:::::::::JJ + JJJJJJJJJ +"; +} +string GetLetterK() +{ + return @" + + + + +KKKKKKKKK KKKKKKK +K:::::::K K:::::K +K:::::::K K:::::K +K:::::::K K::::::K +KK::::::K K:::::KKK + K:::::K K:::::K + K::::::K:::::K + K:::::::::::K + K:::::::::::K + K::::::K:::::K + K:::::K K:::::K +KK::::::K K:::::KKK +K:::::::K K::::::K +K:::::::K K:::::K +K:::::::K K:::::K +KKKKKKKKK KKKKKKK + +"; +} +string GetLetterL() +{ + return @" + +LLLLLLLLLLL +L:::::::::L +L:::::::::L +LL:::::::LL + L:::::L + L:::::L + L:::::L + L:::::L + L:::::L + L:::::L + L:::::L + L:::::L LLLLLL +LL:::::::LLLLLLLLL:::::L +L::::::::::::::::::::::L +L::::::::::::::::::::::L +LLLLLLLLLLLLLLLLLLLLLLLL + + +"; +} +string GetLetterM() +{ + return @" + + +MMMMMMMM MMMMMMMM +M:::::::M M:::::::M +M::::::::M M::::::::M +M:::::::::M M:::::::::M +M::::::::::M M::::::::::M +M:::::::::::M M:::::::::::M +M:::::::M::::M M::::M:::::::M +M::::::M M::::M M::::M M::::::M +M::::::M M::::M::::M M::::::M +M::::::M M:::::::M M::::::M +M::::::M M:::::M M::::::M +M::::::M MMMMM M::::::M +M::::::M M::::::M +M::::::M M::::::M +M::::::M M::::::M +MMMMMMMM MMMMMMMM + +"; +} +string GetLetterN() +{ + return @" + + + + +NNNNNNNN NNNNNNNN +N:::::::N N::::::N +N::::::::N N::::::N +N:::::::::N N::::::N +N::::::::::N N::::::N +N:::::::::::N N::::::N +N:::::::N::::N N::::::N +N::::::N N::::N N::::::N +N::::::N N::::N:::::::N +N::::::N N:::::::::::N +N::::::N N::::::::::N +N::::::N N:::::::::N +N::::::N N::::::::N +N::::::N N:::::::N +N::::::N N::::::N +NNNNNNNN NNNNNNN + +"; +} +string GetLetterO() +{ + return @" + + + OOOOOOOOO + OO:::::::::OO + OO:::::::::::::OO +O:::::::OOO:::::::O +O::::::O O::::::O +O:::::O O:::::O +O:::::O O:::::O +O:::::O O:::::O +O:::::O O:::::O +O:::::O O:::::O +O:::::O O:::::O +O::::::O O::::::O +O:::::::OOO:::::::O + OO:::::::::::::OO + OO:::::::::OO + OOOOOOOOO + +"; +} +string GetLetterP() +{ + return @" + + +PPPPPPPPPPPPPPPPP +P::::::::::::::::P +P::::::PPPPPP:::::P +PP:::::P P:::::P + P::::P P:::::P + P::::P P:::::P + P::::PPPPPP:::::P + P:::::::::::::PP + P::::PPPPPPPPP + P::::P + P::::P + P::::P +PP::::::PP +P::::::::P +P::::::::P +PPPPPPPPPP + + +"; +} +string GetLetterR() +{ + return @" + + +RRRRRRRRRRRRRRRRR +R::::::::::::::::R +R::::::RRRRRR:::::R +RR:::::R R:::::R + R::::R R:::::R + R::::R R:::::R + R::::RRRRRR:::::R + R:::::::::::::RR + R::::RRRRRR:::::R + R::::R R:::::R + R::::R R:::::R + R::::R R:::::R +RR:::::R R:::::R +R::::::R R:::::R +R::::::R R:::::R +RRRRRRRR RRRRRRR + +"; +} +string GetLetterS() +{ + return @" + + + + SSSSSSSSSSSSSSS + SS:::::::::::::::S +S:::::SSSSSS::::::S +S:::::S SSSSSSS +S:::::S +S:::::S + S::::SSSS + SS::::::SSSSS + SSS::::::::SS + SSSSSS::::S + S:::::S + S:::::S +SSSSSSS S:::::S +S::::::SSSSSS:::::S +S:::::::::::::::SS + SSSSSSSSSSSSSSS + +"; +} +string GetLetterT() +{ + return @" + + +TTTTTTTTTTTTTTTTTTTTTTT +T:::::::::::::::::::::T +T:::::::::::::::::::::T +T:::::TT:::::::TT:::::T +TTTTTT T:::::T TTTTTT + T:::::T + T:::::T + T:::::T + T:::::T + T:::::T + T:::::T + T:::::T + TT:::::::TT + T:::::::::T + T:::::::::T + TTTTTTTTTTT + +"; +} +string GetLetterU() +{ + return @" + + +UUUUUUUU UUUUUUUU +U::::::U U::::::U +U::::::U U::::::U +UU:::::U U:::::UU + U:::::U U:::::U + U:::::D D:::::U + U:::::D D:::::U + U:::::D D:::::U + U:::::D D:::::U + U:::::D D:::::U + U:::::D D:::::U + U::::::U U::::::U + U:::::::UUU:::::::U + UU:::::::::::::UU + UU:::::::::UU + UUUUUUUUU + +"; +} +string GetLetterV() +{ + return @" + + + +VVVVVVVV VVVVVVVV +V::::::V V::::::V +V::::::V V::::::V +V::::::V V::::::V + V:::::V V:::::V + V:::::V V:::::V + V:::::V V:::::V + V:::::V V:::::V + V:::::V V:::::V + V:::::V V:::::V + V:::::V:::::V + V:::::::::V + V:::::::V + V:::::V + V:::V + VVV + +"; +} +string GetLetterX() +{ + return @" + + + +XXXXXXX XXXXXXX +X:::::X X:::::X +X:::::X X:::::X +X::::::X X::::::X +XXX:::::X X:::::XXX + X:::::X X:::::X + X:::::X:::::X + X:::::::::X + X:::::::::X + X:::::X:::::X + X:::::X X:::::X +XXX:::::X X:::::XXX +X::::::X X::::::X +X:::::X X:::::X +X:::::X X:::::X +XXXXXXX XXXXXXX + + +"; +} +string GetLetterY() +{ + return @" + + + +YYYYYYY YYYYYYY +Y:::::Y Y:::::Y +Y:::::Y Y:::::Y +Y::::::Y Y::::::Y +YYY:::::Y Y:::::YYY + Y:::::Y Y:::::Y + Y:::::Y:::::Y + Y:::::::::Y + Y:::::::Y + Y:::::Y + Y:::::Y + Y:::::Y + Y:::::Y + YYYY:::::YYYY + Y:::::::::::Y + YYYYYYYYYYYYY + +"; +} +string GetLetterZ() +{ + return @" + + + +ZZZZZZZZZZZZZZZZZZZ +Z:::::::::::::::::Z +Z:::::::::::::::::Z +Z:::ZZZZZZZZ:::::Z +ZZZZZ Z:::::Z + Z:::::Z + Z:::::Z + Z:::::Z + Z:::::Z + Z:::::Z + Z:::::Z +ZZZ:::::Z ZZZZZ +Z::::::ZZZZZZZZ:::Z +Z:::::::::::::::::Z +Z:::::::::::::::::Z +ZZZZZZZZZZZZZZZZZZZ + +"; +} + + + +string GetLetter1() +{ + return @" + + + + 1111111 + 1::::::1 +1:::::::1 +111:::::1 + 1::::1 + 1::::1 + 1::::1 + 1::::l + 1::::l + 1::::l + 1::::l + 1::::l +111::::::111 +1::::::::::1 +1::::::::::1 +111111111111 + +"; +} +string GetLetter2() +{ + return @" + + + + 222222222222222 +2:::::::::::::::22 +2::::::222222:::::2 +2222222 2:::::2 + 2:::::2 + 2:::::2 + 2222::::2 + 22222::::::22 + 22::::::::222 + 2:::::22222 +2:::::2 +2:::::2 +2:::::2 222222 +2::::::2222222:::::2 +2::::::::::::::::::2 +22222222222222222222 + +"; +} +string GetLetter3() +{ + return @" + + + + 333333333333333 +3:::::::::::::::33 +3::::::33333::::::3 +3333333 3:::::3 + 3:::::3 + 3:::::3 + 33333333:::::3 + 3:::::::::::3 + 33333333:::::3 + 3:::::3 + 3:::::3 + 3:::::3 +3333333 3:::::3 +3::::::33333::::::3 +3:::::::::::::::33 + 333333333333333 + +"; +} +string GetLetter4() +{ + return @" + + + + 444444444 + 4::::::::4 + 4:::::::::4 + 4::::44::::4 + 4::::4 4::::4 + 4::::4 4::::4 + 4::::4 4::::4 +4::::444444::::444 +4::::::::::::::::4 +4444444444:::::444 + 4::::4 + 4::::4 + 4::::4 + 44::::::44 + 4::::::::4 + 4444444444 + +"; +} +string GetLetter5() +{ + return @" + + + +555555555555555555 +5::::::::::::::::5 +5::::::::::::::::5 +5:::::555555555555 +5:::::5 +5:::::5 +5:::::5555555555 +5:::::::::::::::5 +555555555555:::::5 + 5:::::5 + 5:::::5 +5555555 5:::::5 +5::::::55555::::::5 + 55:::::::::::::55 + 55:::::::::55 + 555555555 + +"; +} +string GetLetter6() +{ + return @" + + + + 66666666 + 6::::::6 + 6::::::6 + 6::::::6 + 6::::::6 + 6::::::6 + 6::::::6 + 6::::::::66666 +6::::::::::::::66 +6::::::66666:::::6 +6:::::6 6:::::6 +6:::::6 6:::::6 +6::::::66666::::::6 + 66:::::::::::::66 + 66:::::::::66 + 666666666 + +"; +} +string GetLetter7() +{ + return @" + + + +77777777777777777777 +7::::::::::::::::::7 +7::::::::::::::::::7 +777777777777:::::::7 + 7::::::7 + 7::::::7 + 7::::::7 + 7::::::7 + 7::::::7 + 7::::::7 + 7::::::7 + 7::::::7 + 7::::::7 + 7::::::7 + 7::::::7 +77777777 + +"; +} +string GetLetter8() +{ + return @" + + + + 888888888 + 88:::::::::88 + 88:::::::::::::88 +8::::::88888::::::8 +8:::::8 8:::::8 +8:::::8 8:::::8 + 8:::::88888:::::8 + 8:::::::::::::8 + 8:::::88888:::::8 +8:::::8 8:::::8 +8:::::8 8:::::8 +8:::::8 8:::::8 +8::::::88888::::::8 + 88:::::::::::::88 + 88:::::::::88 + 888888888 + +"; +} +string GetLetter9() +{ + return @" + + + + 999999999 + 99:::::::::99 + 99:::::::::::::99 +9::::::99999::::::9 +9:::::9 9:::::9 +9:::::9 9:::::9 + 9:::::99999::::::9 + 99::::::::::::::9 + 99999::::::::9 + 9::::::9 + 9::::::9 + 9::::::9 + 9::::::9 + 9::::::9 + 9::::::9 + 99999999 + +"; +} +string GetLetter0() +{ + return @" + + + + 000000000 + 00:::::::::00 + 00:::::::::::::00 +0:::::::000:::::::0 +0::::::0 0::::::0 +0:::::0 0:::::0 +0:::::0 0:::::0 +0:::::0 000 0:::::0 +0:::::0 000 0:::::0 +0:::::0 0:::::0 +0:::::0 0:::::0 +0::::::0 0::::::0 +0:::::::000:::::::0 + 00:::::::::::::00 + 00:::::::::00 + 000000000 + +"; +} +string GetLetterW() +{ + return @" + + + + +WWWWWWWW WWWWWWWW +W::::::W W::::::W +W::::::W W::::::W +W::::::W W::::::W + W:::::W WWWWW W:::::W + W:::::W W:::::W W:::::W + W:::::W W:::::::W W:::::W + W:::::W W:::::::::W W:::::W + W:::::W W:::::W:::::W W:::::W + W:::::W W:::::W W:::::W W:::::W + W:::::W:::::W W:::::W:::::W + W:::::::::W W:::::::::W + W:::::::W W:::::::W + W:::::W W:::::W + W:::W W:::W + WWW WWW + + +"; +} + diff --git a/pisanie/pisanie.csproj b/pisanie/pisanie.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/pisanie/pisanie.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/projekt1/Program.cs b/projekt1/Program.cs new file mode 100644 index 00000000..ede07125 --- /dev/null +++ b/projekt1/Program.cs @@ -0,0 +1,62 @@ + +//string [,] matrix = new string[30, 5]; +//matrix[0, 2] = "Janko"; +//matrix[0, 3] = "Fero"; +//matrix[0, 4] = "Laco"; +//matrix[0, 5] = "Palo"; + + +////vloz 4 rozne mena +////vypis vsetky mena +//for (int i = 0; i < 30; i++) +//{ +// for (int j = 0; j < 5; j++) +// { +// Console.Write(matrix[i, j] + ", "); +// } +// Console.WriteLine(); +//} + + +//List numbers = new List(); +//Console.WriteLine("Zadaj cislo"); +//string vstup = Console.ReadLine(); + +//while (vstup != "+") +//{ +// numbers.Add(int.Parse(vstup)); +// Console.WriteLine("Zadaj cislo"); +// vstup = Console.ReadLine(); +//} + +//Console.WriteLine("Vysledok:"); +//int sucet = 0; +//foreach (int i in numbers) +// { +// sucet += i; +//} +//Console.WriteLine(sucet); +string meno = ZiskajMeno(); +int vek = ZiskajVek(); +vypisudaje(meno, vek); + +string ZiskajMeno() +{ + Console.WriteLine("Zadaj svoje meno"); + string meno = Console.ReadLine(); + return meno; +} + +int ZiskajVek() +{ + Console.WriteLine("Zadaj svoj vek"); + int vek = int.Parse(Console.ReadLine()); + return vek; +} + +void vypisudaje(string meno, int vek) +{ + Console.WriteLine($"Vitaj {meno} v programe"); + Console.WriteLine($"Mas {vek} rokov"); + +} diff --git a/projekt1/projekt1.csproj b/projekt1/projekt1.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/projekt1/projekt1.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/projekt2/Program.cs b/projekt2/Program.cs new file mode 100644 index 00000000..f07ccb61 --- /dev/null +++ b/projekt2/Program.cs @@ -0,0 +1,27 @@ +//string i = "*"; +//while (i.Length <= 5) +//{ +// Console.WriteLine(i); +// i +="*"; +//} +//while (i.Length > 1) +//{ +// i = i.Remove(i.Length - 1); +// Console.WriteLine(i); +//} + +//int[] cisla = { 10, 25, 36, 45, 84, 45, 47, 75, 56, 55 }; +//int i = 0; +//int vysledek = 0; +//for (i = 0; i < cisla.Length;i++) +//{ +// vysledek += cisla[i]; +//} +//Console.WriteLine(vysledek); + +string[] names = { "dnes", "sa", "mam","dobre" }; +foreach (string name in names) +{ + Console.Write($" {name}" ); +} + diff --git a/projekt2/projekt2.csproj b/projekt2/projekt2.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/projekt2/projekt2.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/simulacia/Animal.cs b/simulacia/Animal.cs new file mode 100644 index 00000000..e30d16aa --- /dev/null +++ b/simulacia/Animal.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.Design; + +namespace simulacia +{ + internal class Animal + { + public bool bylinozravec = false; + public void setfood(bool siBylinozravec) + { + bylinozravec = siBylinozravec; + } + public bool CanEatOtherAnimal() + { + if (bylinozravec) + { + return false; + } + else + { + return true; + } + } } +} + diff --git a/simulacia/Program.cs b/simulacia/Program.cs new file mode 100644 index 00000000..bccbf7fc --- /dev/null +++ b/simulacia/Program.cs @@ -0,0 +1,20 @@ +//trieda animal +//2 zvierata +// 1. mesozravec +//2. bylinozravec +// bylino zje ine zviera +//mesozrav zje ine zviera + + + +using simulacia; + +Animal bylinozravec = new Animal(); +bylinozravec.setfood(true); +Animal mesozravec = new Animal(); +mesozravec.setfood(false); +bylinozravec.CanEatOtherAnimal(); +bool MozeBylinozravecJest = bylinozravec.CanEatOtherAnimal(); +bool MozeMesozravecJest = mesozravec.CanEatOtherAnimal(); +Console.WriteLine($" bylinozravec {MozeBylinozravecJest}"); +Console.WriteLine($" mesozravec {MozeMesozravecJest}"); diff --git a/simulacia/simulacia.csproj b/simulacia/simulacia.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/simulacia/simulacia.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/src/AppsLab-001-StartHere/Greetings.cs b/src/AppsLab-001-StartHere/Greetings.cs index fbe10953..180f4a71 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..b6623f7d 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 = 15 ; +string name = "Patrik" ; + +Console.WriteLine($"My name is {name}, you i am {age} years old!"); + + diff --git a/src/AppsLab-005-DataTypes/Program.cs b/src/AppsLab-005-DataTypes/Program.cs index 3751555c..e9c4d35d 100644 --- a/src/AppsLab-005-DataTypes/Program.cs +++ b/src/AppsLab-005-DataTypes/Program.cs @@ -1,2 +1,20 @@ // See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +int mojeCislo = 10; +string mojeSlovo = "Ahoj Svet"; +bool mojaBoolhoHodnota = true; +DateTime dnesnydatum = DateTime.Now; +float myfloat = 20.54f; +var myvar = ("var string ide"); + +int sucet = mojeCislo + 5; + +Console.WriteLine($"Súčet je: {sucet}"); +Console.WriteLine($"Dnes je: {dnesnydatum.ToString("yyyy-MM-dd")}"); +Console.WriteLine($"Moje slovo je: {mojeSlovo}"); +Console.WriteLine($"Moja bool hodnota je: {mojaBoolhoHodnota}"); +Console.WriteLine("10"); +Console.WriteLine(myfloat); +Console.WriteLine(myvar); + + + diff --git a/src/AppsLab-006-Constants/Program.cs b/src/AppsLab-006-Constants/Program.cs index 3751555c..1bcbbe10 100644 --- a/src/AppsLab-006-Constants/Program.cs +++ b/src/AppsLab-006-Constants/Program.cs @@ -1,2 +1,10 @@ // 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 = ("Vitajte v nasej hre"); + +Console.WriteLine(MaxPoints); +Console.WriteLine(MinAgeForDriversLicense); +Console.WriteLine(WelcomeMessage); + + diff --git a/src/AppsLab-007-Casting/Converter.cs b/src/AppsLab-007-Casting/Converter.cs index a64ce567..3ad4b146 100644 --- a/src/AppsLab-007-Casting/Converter.cs +++ b/src/AppsLab-007-Casting/Converter.cs @@ -10,7 +10,8 @@ public class Converter /// public double IntToDouble(int number) { - throw new NotImplementedException(); + return Convert.ToDouble(number); + } /// @@ -18,7 +19,7 @@ public double IntToDouble(int number) /// public int DoubleToInt(double number) { - throw new NotImplementedException(); + return Convert.ToInt32(number); } /// @@ -26,7 +27,7 @@ public int DoubleToInt(double number) /// public double StringToDouble(string number) { - throw new NotImplementedException(); + return Convert.ToDouble(number); } /// @@ -34,7 +35,7 @@ public double StringToDouble(string number) /// public string DoubleToString(double number) { - throw new NotImplementedException(); + return Convert.ToString(number); } /// @@ -42,7 +43,7 @@ public string DoubleToString(double number) /// public string IntToString(int number) { - throw new NotImplementedException(); + return Convert.ToString(number); } /// @@ -50,7 +51,7 @@ public string IntToString(int number) /// public bool StringToBool(string boolValue) { - throw new NotImplementedException(); + return Convert.ToBoolean(boolValue); } /// @@ -58,6 +59,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/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index 6f7376c9..98325f17 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -1,8 +1,19 @@ -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."); +Console.BackgroundColor = ConsoleColor.DarkBlue; +Console.Clear(); + + +Console.WriteLine("Vitaj v kalkulacke"); +Console.WriteLine("Zadaj prve cislo:"); +string? cislo1 = Console.ReadLine() ?? "0"; +Console.WriteLine("Zadaj druhe cislo:"); +string? cislo2 = Console.ReadLine() ?? "0"; +int sucet = int.Parse(cislo1) + int.Parse(cislo2); +Console.WriteLine($"Suma {cislo1} a {cislo2} je {sucet}"); + + + + + + + + diff --git a/src/AppsLab-009-Operators/Calculator.cs b/src/AppsLab-009-Operators/Calculator.cs index 981993a9..4715ca0e 100644 --- a/src/AppsLab-009-Operators/Calculator.cs +++ b/src/AppsLab-009-Operators/Calculator.cs @@ -10,15 +10,14 @@ public class Calculator /// public int Add(int a, int b) { - throw new NotImplementedException(); + return a + b; } - /// /// This method subtracts two integers and returns the difference. /// public int Subtract(int a, int b) { - throw new NotImplementedException(); + return a - b; } /// @@ -26,7 +25,7 @@ public int Subtract(int a, int b) /// public int Multiply(int a, int b) { - throw new NotImplementedException(); + return a * b; } /// @@ -34,7 +33,7 @@ public int Multiply(int a, int b) /// public double Divide(int a, int b) { - throw new NotImplementedException(); + return (double)a / b; } /// @@ -42,7 +41,7 @@ public double Divide(int a, int b) /// public int Remainder(int a, int b) { - throw new NotImplementedException(); + return a % b; } /// @@ -50,7 +49,7 @@ public int Remainder(int a, int b) /// public bool AreEqual(int a, int b) { - throw new NotImplementedException(); + return a == b; } /// @@ -58,7 +57,7 @@ public bool AreEqual(int a, int b) /// public bool AreNotEqual(int a, int b) { - throw new NotImplementedException(); + return a != b; } /// @@ -66,7 +65,7 @@ public bool AreNotEqual(int a, int b) /// public bool IsGreater(int a, int b) { - throw new NotImplementedException(); + return a > b; } /// @@ -74,7 +73,7 @@ public bool IsGreater(int a, int b) /// public bool IsLesser(int a, int b) { - throw new NotImplementedException(); + return a < b; } /// @@ -82,7 +81,7 @@ public bool IsLesser(int a, int b) /// public bool IsGreaterOrEqual(int a, int b) { - throw new NotImplementedException(); + return a >= b; } /// @@ -90,6 +89,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-011-Strings/StringManipulator.cs b/src/AppsLab-011-Strings/StringManipulator.cs index f226d70d..df16bcc1 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,19 @@ 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 + + + public int getLeghth(string input) + { + return input.Length; + } + + public int nomedzery(string input) + { + return input.Trim().Length; + } + + +} diff --git a/src/AppsLab-014-Switch/MovieRating.cs b/src/AppsLab-014-Switch/MovieRating.cs index ab689d49..07735a12 100644 --- a/src/AppsLab-014-Switch/MovieRating.cs +++ b/src/AppsLab-014-Switch/MovieRating.cs @@ -1,17 +1,28 @@ namespace AppsLab_014_Switch; - -/// -/// Provides methods for working with movie ratings. -/// public class MovieRating { - /// - /// Gets a description of the specified movie rating. - /// - /// The movie rating to get a description for. - /// 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..3d78c2d0 100644 --- a/src/AppsLab-015-Arrays/ArrayProcessor.cs +++ b/src/AppsLab-015-Arrays/ArrayProcessor.cs @@ -13,7 +13,11 @@ 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) + { + return 0; + } + return numbers[0]; } /// @@ -24,7 +28,11 @@ 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 == null || numbers.Length == 0) + { + return 0; + } + return numbers[numbers.Length - 1]; } /// @@ -36,7 +44,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 +59,8 @@ public int GetElementAtPosition(int[] numbers, int position) /// Length of the array. public int GetLength(int[] numbers) { - throw new NotImplementedException(); + if (numbers == null) + return 0; + return numbers.Length; } } diff --git a/src/AppsLab-016-Loops/WeatherStats.cs b/src/AppsLab-016-Loops/WeatherStats.cs index 8bca9659..ff1bc7f6 100644 --- a/src/AppsLab-016-Loops/WeatherStats.cs +++ b/src/AppsLab-016-Loops/WeatherStats.cs @@ -12,7 +12,13 @@ public class WeatherStats /// Average temperature. public double AverageTemperature(double[] temperatures) { - throw new NotImplementedException(); + double priemer = 0; + foreach (double temperature in temperatures) + { + priemer += temperature; + } + return priemer / temperatures.Length; + } /// @@ -22,7 +28,15 @@ public double AverageTemperature(double[] temperatures) /// Maximum temperature. public double MaxTemperature(double[] temperatures) { - throw new NotImplementedException(); + double maximum = double.MinValue; + foreach (double temperature in temperatures) + { + if (temperature > maximum) + { + maximum = temperature; + } + } + return maximum; } /// @@ -32,6 +46,14 @@ public double MaxTemperature(double[] temperatures) /// Minimum temperature. public double MinTemperature(double[] temperatures) { - throw new NotImplementedException(); + double minimum = double.MaxValue; + foreach (double temperature in temperatures) + { + if (temperature < minimum) + { + minimum = temperature; + } + } + return minimum; } } diff --git a/src/AppsLab-019-MethodsOverloading/PasswordGenerator.cs b/src/AppsLab-019-MethodsOverloading/PasswordGenerator.cs index b48403a4..3d733dd5 100644 --- a/src/AppsLab-019-MethodsOverloading/PasswordGenerator.cs +++ b/src/AppsLab-019-MethodsOverloading/PasswordGenerator.cs @@ -18,7 +18,7 @@ public class PasswordGenerator /// A randomly generated password. public string GeneratePassword() { - throw new NotImplementedException(); + return GeneratePassword(DefaultLength); } /// @@ -28,7 +28,13 @@ public string GeneratePassword() /// A randomly generated password. public string GeneratePassword(int length) { - throw new NotImplementedException(); + string password = ""; + for (int i = 0; i < length; i++) + { + int randomNumber = _random.Next(27); + password = password + Alphabet[randomNumber].ToString(); + } + return password; } /// @@ -40,7 +46,18 @@ public string GeneratePassword(int length) /// A randomly generated password. public string GeneratePassword(int length, bool includeSpecialChars, bool includeNumbers) { - throw new NotImplementedException(); + string password = GeneratePassword(length); + if (includeSpecialChars) + { + int index = _random.Next(0, 9); + password.Replace(password[length - 1], SpecialChars[index]); + } + if (includeNumbers) + { + int index = _random.Next(0, 9); + password.Replace(password[0], Numbers[index]); + } + return password; } } -} \ No newline at end of file +} diff --git a/src/AppsLab-019-MethodsOverloading/Program.cs b/src/AppsLab-019-MethodsOverloading/Program.cs index 3751555c..a8d523c6 100644 --- a/src/AppsLab-019-MethodsOverloading/Program.cs +++ b/src/AppsLab-019-MethodsOverloading/Program.cs @@ -1,2 +1 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +Random random = new Random(); diff --git a/src/AppsLab-022-Files/Program.cs b/src/AppsLab-022-Files/Program.cs index 3751555c..56271992 100644 --- a/src/AppsLab-022-Files/Program.cs +++ b/src/AppsLab-022-Files/Program.cs @@ -1,2 +1,16 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +string filename = "C:\\Users\\smrzo\\Documents\\projekty VisualStudio\\nacitanie textu.txt"; + +Console.WriteLine(File.ReadAllText(filename)); +while (true) +{ + Console.WriteLine("zadaj text alebo napis koniec pre ukoncenie programu"); + string input = Console.ReadLine(); + Console.ReadKey(); + if (input.ToLower() == "koniec") + { + Console.WriteLine("ukonil si program"); + break; + } + File.AppendAllText(filename, input + " \n"); +} + diff --git a/src/AppsLab-025-Lambda/Program.cs b/src/AppsLab-025-Lambda/Program.cs index 3751555c..86232fa9 100644 --- a/src/AppsLab-025-Lambda/Program.cs +++ b/src/AppsLab-025-Lambda/Program.cs @@ -1,2 +1,42 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +int[] numbers = new int[100000000]; + +//for (int i = 0; i < numbers.Length; i++) +//{ +// for (int j = 0; j < numbers.Length; j++) +// { +// int buble = numbers[i + 1]; +// if (buble == 0) +// { +// numbers[j + 1] = buble; +// numbers[j] = buble; + + +// } +// } +//} +DateTime now = DateTime.Now; +numbers = numbers.Order().ToArray(); +Console.WriteLine(DateTime.Now - now); + +now = DateTime.Now; +for (int j = 0; j < numbers.Length - 1; j++) +{ + for (int i = 0; i < numbers.Length - 1; i++) + { + int cislo1 = numbers[i]; + int cislo2 = numbers[i + 1]; + if (cislo1 > cislo2) + { + int buble = cislo1; + cislo1 = cislo2; + cislo2 = buble; + numbers[i] = cislo1; + numbers[i + 1] = cislo2; + } + } +} +Console.WriteLine(DateTime.Now - now); +//foreach (int number in numbers) +//{ +// Console.WriteLine(number); +//} \ No newline at end of file diff --git a/src/AppsLab-026-LINQ/Program.cs b/src/AppsLab-026-LINQ/Program.cs index 3751555c..6529beaf 100644 --- a/src/AppsLab-026-LINQ/Program.cs +++ b/src/AppsLab-026-LINQ/Program.cs @@ -1,2 +1,24 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +using AppsLab_026_LINQ; + +List students = new List(); +students.Add(new student { Name = "David", Age = 16 }); +students.Add(new student { Name = "Patrik", Age = 15 }); +students.Add(new student { Name = "Alex", Age = 15 }); +students.Add(new student { Name = "Michal", Age = 15 }); +students.Add(new student { Name = "Kristian", Age = 16 }); +students.Add(new student { Name = "Fabio", Age = 16 }); +students.Add(new student { Name = "Lukas", Age = 15 }); +students.Add(new student { Name = "Michal", Age = 15 }); +students.Add(new student { Name = "Matus", Age = 15 }); +students.Add(new student { Name = "Michal", Age = 15 }); +students.Add(new student { Name = "Marek", Age = 18 }); +students.Add(new student { Name = "Michal", Age = 15 }); +students.Add(new student { Name = "Matej", Age = 15 }); +students.Add(new student { Name = "Rudo", Age = 16 }); + +var outputStudents = students.GroupBy(s => s.Name); + +foreach(var student in outputStudents) +{ + Console.WriteLine($"Meno: {student.Key}"); +} diff --git a/src/AppsLab-026-LINQ/student.cs b/src/AppsLab-026-LINQ/student.cs new file mode 100644 index 00000000..ef12f9e5 --- /dev/null +++ b/src/AppsLab-026-LINQ/student.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AppsLab_026_LINQ +{ + internal class student + { + public string Name { get; set; } + + public int Age { get; set; } + } +} diff --git a/student/Program.cs b/student/Program.cs new file mode 100644 index 00000000..19facc6a --- /dev/null +++ b/student/Program.cs @@ -0,0 +1,18 @@ +//student +// meno vek +//ci student moze legalne pit alkohol +//nastvit meno +//"meno" moze pit alebo nemoze pit + + +using student; + +studenT student = new studenT(); +string studentName = Console.ReadLine(); +student.setName(studentName); + +bool mozepit = student.CanDrinkAlcohol(); +Console.WriteLine($"{}") + + + diff --git a/student/studenT.cs b/student/studenT.cs new file mode 100644 index 00000000..06f85a9c --- /dev/null +++ b/student/studenT.cs @@ -0,0 +1,20 @@ + +namespace student +{ + internal class studenT + { + private string NameStud; + public int ageStud = 18; + + + public bool CanDrinkAlcohol() + { + return ageStud == 18; + + } + internal void setName(string name) + { + NameStud = name; + } + } +} diff --git a/student/student.csproj b/student/student.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/student/student.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/tests/AppsLab-007-Casting.Tests/ConverterTests.cs b/tests/AppsLab-007-Casting.Tests/ConverterTests.cs index e9d8642c..7c95b1bf 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.2); 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] diff --git a/tests/AppsLab-011-Strings.Tests/StringManipulatorTests.cs b/tests/AppsLab-011-Strings.Tests/StringManipulatorTests.cs index a1efacac..e733687c 100644 --- a/tests/AppsLab-011-Strings.Tests/StringManipulatorTests.cs +++ b/tests/AppsLab-011-Strings.Tests/StringManipulatorTests.cs @@ -80,9 +80,9 @@ public void StartsWithSubstring_StartsWithSubstring() /// Tests the method. /// [Test] - public void StartsWithSubstring_DoesNotStartWithSubstring() + public void StringJespace() { - var result = _stringManipulator.StartsWithSubstring("Hello World", "Goodbye"); - Assert.That(result, Is.False, "The string starts with the substring when it should not."); + var result = _stringManipulator.Jespace(" Hello World "); + Assert.That(result == "Hello World"); } } \ No newline at end of file