diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 58bbf6b5..43bcf188 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -93,10 +93,21 @@ 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 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Graffiti", "Graffiti\Graffiti.csproj", "{7EC7847B-446A-D9D6-6195-5BEA35D37491}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OOP", "OOP\OOP.csproj", "{51C37F51-5779-48A7-AC43-5BFE51FD344E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "zivocisny retazec", "zivocisny retazec\zivocisny retazec.csproj", "{BEAB9223-2A8A-4B4E-9446-A098954277B9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "meno vek", "meno vek\meno vek.csproj", "{160AD86D-9938-4D1F-8867-7AB170C7B2BA}" +EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -226,18 +237,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 +633,93 @@ 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 + {7EC7847B-446A-D9D6-6195-5BEA35D37491}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7EC7847B-446A-D9D6-6195-5BEA35D37491}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7EC7847B-446A-D9D6-6195-5BEA35D37491}.Debug|x64.ActiveCfg = Debug|Any CPU + {7EC7847B-446A-D9D6-6195-5BEA35D37491}.Debug|x64.Build.0 = Debug|Any CPU + {7EC7847B-446A-D9D6-6195-5BEA35D37491}.Debug|x86.ActiveCfg = Debug|Any CPU + {7EC7847B-446A-D9D6-6195-5BEA35D37491}.Debug|x86.Build.0 = Debug|Any CPU + {7EC7847B-446A-D9D6-6195-5BEA35D37491}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7EC7847B-446A-D9D6-6195-5BEA35D37491}.Release|Any CPU.Build.0 = Release|Any CPU + {7EC7847B-446A-D9D6-6195-5BEA35D37491}.Release|x64.ActiveCfg = Release|Any CPU + {7EC7847B-446A-D9D6-6195-5BEA35D37491}.Release|x64.Build.0 = Release|Any CPU + {7EC7847B-446A-D9D6-6195-5BEA35D37491}.Release|x86.ActiveCfg = Release|Any CPU + {7EC7847B-446A-D9D6-6195-5BEA35D37491}.Release|x86.Build.0 = Release|Any CPU + {51C37F51-5779-48A7-AC43-5BFE51FD344E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {51C37F51-5779-48A7-AC43-5BFE51FD344E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {51C37F51-5779-48A7-AC43-5BFE51FD344E}.Debug|x64.ActiveCfg = Debug|Any CPU + {51C37F51-5779-48A7-AC43-5BFE51FD344E}.Debug|x64.Build.0 = Debug|Any CPU + {51C37F51-5779-48A7-AC43-5BFE51FD344E}.Debug|x86.ActiveCfg = Debug|Any CPU + {51C37F51-5779-48A7-AC43-5BFE51FD344E}.Debug|x86.Build.0 = Debug|Any CPU + {51C37F51-5779-48A7-AC43-5BFE51FD344E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {51C37F51-5779-48A7-AC43-5BFE51FD344E}.Release|Any CPU.Build.0 = Release|Any CPU + {51C37F51-5779-48A7-AC43-5BFE51FD344E}.Release|x64.ActiveCfg = Release|Any CPU + {51C37F51-5779-48A7-AC43-5BFE51FD344E}.Release|x64.Build.0 = Release|Any CPU + {51C37F51-5779-48A7-AC43-5BFE51FD344E}.Release|x86.ActiveCfg = Release|Any CPU + {51C37F51-5779-48A7-AC43-5BFE51FD344E}.Release|x86.Build.0 = Release|Any CPU + {BEAB9223-2A8A-4B4E-9446-A098954277B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BEAB9223-2A8A-4B4E-9446-A098954277B9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BEAB9223-2A8A-4B4E-9446-A098954277B9}.Debug|x64.ActiveCfg = Debug|Any CPU + {BEAB9223-2A8A-4B4E-9446-A098954277B9}.Debug|x64.Build.0 = Debug|Any CPU + {BEAB9223-2A8A-4B4E-9446-A098954277B9}.Debug|x86.ActiveCfg = Debug|Any CPU + {BEAB9223-2A8A-4B4E-9446-A098954277B9}.Debug|x86.Build.0 = Debug|Any CPU + {BEAB9223-2A8A-4B4E-9446-A098954277B9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BEAB9223-2A8A-4B4E-9446-A098954277B9}.Release|Any CPU.Build.0 = Release|Any CPU + {BEAB9223-2A8A-4B4E-9446-A098954277B9}.Release|x64.ActiveCfg = Release|Any CPU + {BEAB9223-2A8A-4B4E-9446-A098954277B9}.Release|x64.Build.0 = Release|Any CPU + {BEAB9223-2A8A-4B4E-9446-A098954277B9}.Release|x86.ActiveCfg = Release|Any CPU + {BEAB9223-2A8A-4B4E-9446-A098954277B9}.Release|x86.Build.0 = Release|Any CPU + {160AD86D-9938-4D1F-8867-7AB170C7B2BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {160AD86D-9938-4D1F-8867-7AB170C7B2BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {160AD86D-9938-4D1F-8867-7AB170C7B2BA}.Debug|x64.ActiveCfg = Debug|Any CPU + {160AD86D-9938-4D1F-8867-7AB170C7B2BA}.Debug|x64.Build.0 = Debug|Any CPU + {160AD86D-9938-4D1F-8867-7AB170C7B2BA}.Debug|x86.ActiveCfg = Debug|Any CPU + {160AD86D-9938-4D1F-8867-7AB170C7B2BA}.Debug|x86.Build.0 = Debug|Any CPU + {160AD86D-9938-4D1F-8867-7AB170C7B2BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {160AD86D-9938-4D1F-8867-7AB170C7B2BA}.Release|Any CPU.Build.0 = Release|Any CPU + {160AD86D-9938-4D1F-8867-7AB170C7B2BA}.Release|x64.ActiveCfg = Release|Any CPU + {160AD86D-9938-4D1F-8867-7AB170C7B2BA}.Release|x64.Build.0 = Release|Any CPU + {160AD86D-9938-4D1F-8867-7AB170C7B2BA}.Release|x86.ActiveCfg = Release|Any CPU + {160AD86D-9938-4D1F-8867-7AB170C7B2BA}.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 +765,11 @@ 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} + {7EC7847B-446A-D9D6-6195-5BEA35D37491} = {56555FB0-B513-49EF-9002-A5AF135EA090} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {87DB432D-BF83-4F67-A077-8E0F02BE9F55} EndGlobalSection EndGlobal diff --git a/Graffiti/Graffiti.csproj b/Graffiti/Graffiti.csproj new file mode 100644 index 00000000..fd4bd08d --- /dev/null +++ b/Graffiti/Graffiti.csproj @@ -0,0 +1,10 @@ + + + + Exe + net9.0 + enable + enable + + + diff --git a/Graffiti/Program.cs b/Graffiti/Program.cs new file mode 100644 index 00000000..9d37c0f4 --- /dev/null +++ b/Graffiti/Program.cs @@ -0,0 +1,409 @@ + +using System.Reflection.Metadata; +using System.Runtime.CompilerServices; + +Console.Clear(); + +Console.WriteLine("zadaj text"); +string input = Console.ReadLine(); +input = input.ToLower(); +string output = ""; +string[,] matrix = new string[35, 130]; +int offset = 0; +foreach (char letter in input) +{ + output = output + GetLetter(letter.ToString()); +} + + +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 input ) +{ + return input switch + { + "a" or "A"=> GetLetterA(), + "b" or "B"=> GetLetterB(), + "c" or "C"=> GetLetterC(), + "d" or "D"=> GetLetterD(), + "e" or "E"=> GetLetterE(), + "f" or "F"=> GetLetterF(), + "g" or "G"=> GetLetterG(), + "h" or "H"=> GetLetterH(), + "i" or "I"=> GetLetterI(), + "j" or "J"=> GetLetterJ(), + "k" or "K"=> GetLetterK(), + "l" or "L"=> GetLetterL(), + "m" or "M"=> GetLetterM(), + "n" or "N"=> GetLetterN(), + "o" or "O"=> GetLetterO(), + "p" or "P"=> GetLetterP(), + "q" or "Q"=> GetLetterQ(), + "r" or "R"=> GetLetterR(), + "s" or "S"=> GetLetterS(), + "t" or "T"=> GetLetterT(), + "u" or "U"=> GetLetterU(), + "v" or "V"=> GetLetterV(), + "w" or "W"=> GetLetterW(), + "x" or "X"=> GetLetterX(), + "y" or "Y"=> GetLetterY(), + "z" or "Z"=> getLetterZ(), + _ => "zle pismeno lil boy" + + }; +} + + + +string GetLetterA() +{ + return @" + ___ + / _ \ +/ /_\ \ +| _ | +| | | | +\_| |_/ + + "; +} +string GetLetterB() +{ + return @" +______ +| ___ \ +| |_/ / +| ___ \ +| |_/ / +\____/ + + "; +} +string GetLetterC() +{ + return @" + _____ +/ __ \ +| / \/ +| | +| \__/\ + \____/ + + "; +} +string GetLetterD() +{ + return @" +______ +| _ \ +| | | | +| | | | +| |/ / +|___/ + + + +"; +} + +string GetLetterE() +{ + return @" + _____ +| ___| +| |__ +| __| +| |___ +\____/ + + + + "; +} + + +string GetLetterF() +{ + return @" +______ +| ___| +| |_ +| _| +| | +\_| + + "; +} +string GetLetterG() +{ + + return @" + _____ +| __ \ +| | \/ +| | __ +| |_\ \ + \____/ + + "; +} +string GetLetterH() +{ + + return @" + _ _ +| | | | +| |_| | +| _ | +| | | | +\_| |_/ + + + + "; +} +string GetLetterI() +{ + return @" + _____ +|_ _| + | | + | | + _| |_ + \___/ + + + + "; +} +string GetLetterJ() +{ + return @" + ___ + |_ | + | | + | | +/\__/ / +\____/ + + "; +} +string GetLetterK() +{ + return @" + _ __ +| | / / +| |/ / +| \ +| |\ \ +\_| \_/ + + "; +} +string GetLetterL() +{ + return @" +_ +| | +| | +| | +| |____ +\_____/ + + +"; +} +string GetLetterM() +{ + return @" +___ ___ +| \/ | +| . . | +| |\/| | +| | | | +\_| |_/ + + "; +} +string GetLetterN() +{ + + return @" + _ _ +| \ | | +| \| | +| . ` | +| |\ | +\_| \_/ + + "; +} +string GetLetterO() +{ + return @" + _____ +| _ | +| | | | +| | | | +\ \_/ / + \___/ + + "; +} +string GetLetterP() +{ + return @" +______ +| ___ \ +| |_/ / +| __/ +| | +\_| + + "; + +} +string GetLetterQ() +{ + return @" + _____ +| _ | +| | | | +| | | | +\ \/' / + \_/\_\ + + "; +} +string GetLetterR() +{ + return @" +______ +| ___ \ +| |_/ / +| / +| |\ \ +\_| \_| + + "; +} + string GetLetterS() +{ + return @" + _____ +/ ___| +\ `--. + `--. \ +/\__/ / +\____/ + + "; +} +string GetLetterT() +{ + return @" + _____ +|_ _| + | | + | | + | | + \_/ + + "; +} +string GetLetterU() +{ + return @" + _ _ +| | | | +| | | | +| | | | +| |_| | + \___/ + + "; +} +string GetLetterV() +{ + return @" + _ _ +| | | | +| | | | +| | | | +\ \_/ / + \___/ + + "; +} +string GetLetterW() +{ + return @" _ _ +| | | | +| | | | +| |/\| | +\ /\ / + \/ \/ + + "; +} +string GetLetterX() +{ + return @" +__ __ +\ \ / / + \ V / + / \ +/ /^\ \ +\/ \/ + + "; +} + string GetLetterY() +{ + return @" +__ __ +\ \ / / + \ V / + \ / + | | + \_/ + + "; +} +string getLetterZ() +{ + return @" +______ +|___ / + / / + / / +./ /___ +\_____/ + + "; +} \ No newline at end of file diff --git a/OOP/Monster.cs b/OOP/Monster.cs new file mode 100644 index 00000000..1be3f89d --- /dev/null +++ b/OOP/Monster.cs @@ -0,0 +1,29 @@ + +using System.Data.Common; + +namespace OOP +{ + public class Monster + { + private string Name; + private const int MaxHp = 200; + private const int MinHp = 0; + private int currentHP = MaxHp; + private int MDamage = 10; + + internal void TakeDamage(int damage) + { + currentHP -= damage; + } + public bool DealDamage(player opponent) + { + opponent.TakeDamage(MDamage); + return true; + } + + internal void SetName(string? MonName) + { + Name = MonName; + } + } +} \ No newline at end of file diff --git a/OOP/OOP.csproj b/OOP/OOP.csproj new file mode 100644 index 00000000..fd4bd08d --- /dev/null +++ b/OOP/OOP.csproj @@ -0,0 +1,10 @@ + + + + Exe + net9.0 + enable + enable + + + diff --git a/OOP/Program.cs b/OOP/Program.cs new file mode 100644 index 00000000..caa2a2cf --- /dev/null +++ b/OOP/Program.cs @@ -0,0 +1,16 @@ +using OOP; +string Pname = Console.ReadLine(); +player player = new player(); +player.SetName(Pname); +string MonName = Console.ReadLine(); +Monster monster = new Monster(); +monster.SetName(MonName); +player.DealDamage(monster); +monster.DealDamage(player); +Console.WriteLine(); + +/* + * random damage + * prisera robi damage + * hrac dostane meno + */ diff --git a/OOP/player.cs b/OOP/player.cs new file mode 100644 index 00000000..a3788db4 --- /dev/null +++ b/OOP/player.cs @@ -0,0 +1,27 @@ + +namespace OOP +{ + public class player + { + private string Name; + private const int MaxHp = 100; + private const int MinHp = 0; + private int currentHP = MaxHp; + private int Pladamage = 20; + private List Inventar = new List(); + internal void TakeDamage(int damage) + { + currentHP -= damage; + } + public bool DealDamage( Monster opponent) + { + opponent.TakeDamage(Pladamage); + return true; + } + + internal void SetName(string? pname) + { + Name = pname; + } + } +} 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/meno vek/Program.cs b/meno vek/Program.cs new file mode 100644 index 00000000..0a5e5752 --- /dev/null +++ b/meno vek/Program.cs @@ -0,0 +1,21 @@ + using meno_vek; +Console.WriteLine("zadaj meno"); + string meno = Console.ReadLine(); + Clovek clovek = new Clovek(); + clovek.SetName(meno); + Console.WriteLine(meno); +Console.WriteLine($"zadaj vek {meno}"); +int vekInput = int.Parse(Console.ReadLine()); +clovek.SetAge(vekInput); +bool mozes = clovek.MozesPit(); + if (mozes == false) + { + Console.WriteLine("nemozes pit ujo"); + } + else + { + Console.WriteLine("uz mozes pit "); + } + + + diff --git a/meno vek/clovek.cs b/meno vek/clovek.cs new file mode 100644 index 00000000..9822533f --- /dev/null +++ b/meno vek/clovek.cs @@ -0,0 +1,36 @@ + +namespace meno_vek +{ + internal class Clovek + { + int vek; + public void SetName(string? meno) + { + Pname = meno; + + } + internal void SetAge(int vekInput) + { + vek = vekInput; + + } + + + string Pname = ""; + + public bool MozesPit() + { + if (vek >= 18) + { + return true; + } + else + { + return false; + } + } + + + } +} + diff --git a/meno vek/meno vek.csproj b/meno vek/meno vek.csproj new file mode 100644 index 00000000..020e95a6 --- /dev/null +++ b/meno vek/meno vek.csproj @@ -0,0 +1,11 @@ + + + + Exe + net9.0 + meno_vek + 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..235bffdc 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,14 @@ 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); + } + public int GetLegth (string input) + { + return input.Length; + } + public string BezMedzier(string input) + { + return input.Trim(); } } \ 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..a7718f82 100644 --- a/src/AppsLab-015-Arrays/ArrayProcessor.cs +++ b/src/AppsLab-015-Arrays/ArrayProcessor.cs @@ -11,9 +11,18 @@ public class ArrayProcessor /// /// Array of integers. /// 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 +32,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 +50,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 +65,10 @@ 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..521a29f4 100644 --- a/src/AppsLab-016-Loops/WeatherStats.cs +++ b/src/AppsLab-016-Loops/WeatherStats.cs @@ -1,4 +1,7 @@ -namespace AppsLab_016_Loops; +using System.Reflection.Metadata.Ecma335; +using System.Security.Cryptography; + +namespace AppsLab_016_Loops; /// /// Class to calculate weather statistics. @@ -12,18 +15,33 @@ 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; } /// /// 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(); + double maximum = double.MinValue; + foreach ( double temperature in temperatures) + { + if (temperature > maximum) + { + maximum = temperature; + } + } + return maximum; } + + /// /// Find the minimum temperature from the provided values. @@ -32,6 +50,15 @@ 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-020-OOP/Program.cs b/src/AppsLab-020-OOP/Program.cs index 3751555c..b539b808 100644 --- a/src/AppsLab-020-OOP/Program.cs +++ b/src/AppsLab-020-OOP/Program.cs @@ -1,2 +1,8 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +public class MatejKolkus +{ + private decimal balance; + public void deposit(decimal amount) + { + + } +} \ No newline at end of file diff --git a/test/Program.cs b/test/Program.cs new file mode 100644 index 00000000..d3e9f7e6 --- /dev/null +++ b/test/Program.cs @@ -0,0 +1,91 @@ +/*string i = "*"; +while (i.Length < 6) +{ + Console.WriteLine(i); + i += "*"; +} +string j = "*****"; +while (j.Length > 0) +{ + Console.WriteLine(j); + j = j.Substring(0, j.Length -1); +} + +string s = "abcd"; + s = s.Substring(1,3); +Console.WriteLine(s); + +* +using System.Diagnostics.CodeAnalysis; +using System.Globalization; + +int[] cisla = new int[10] {1, 2, 3, 5, 6, 4, 7, 8, 9, 10}; +int i = 0; +int sucet = 0; +for (i = 0; i < cisla.Length; i++) +{ + sucet += cisla[i]; +} +Console.WriteLine($"Sucet je {sucet}"); +* + +string[] names = new string[4] { "dnes", "sa", "mam", "dobre", }; +foreach (string name in names) +{ + Console.Write($" {name} "); +} +* + + +using System.Globalization; + +List numbers = new List { 1, 2, 3 }; + +foreach (var number in numbers) + numbers.Add(45); + +{ + Console.WriteLine(numbers); +} +* + +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 scitania:"); +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($"Ahoj {meno}, mas {vek} rokov."); +} \ No newline at end of file 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] diff --git a/tests/AppsLab-011-Strings.Tests/StringManipulatorTests.cs b/tests/AppsLab-011-Strings.Tests/StringManipulatorTests.cs index a1efacac..c93ef8da 100644 --- a/tests/AppsLab-011-Strings.Tests/StringManipulatorTests.cs +++ b/tests/AppsLab-011-Strings.Tests/StringManipulatorTests.cs @@ -85,4 +85,10 @@ public void StartsWithSubstring_DoesNotStartWithSubstring() var result = _stringManipulator.StartsWithSubstring("Hello World", "Goodbye"); Assert.That(result, Is.False, "The string starts with the substring when it should not."); } + [Test] + public void Stringjebezmedzier() + { + var result = _stringManipulator.BezMedzier("Hello World"); + Assert.That(result == "Hello World"); + } } \ No newline at end of file diff --git a/tests/AppsLab-016-Loops.Tests/WeatherStatsTests.cs b/tests/AppsLab-016-Loops.Tests/WeatherStatsTests.cs index 1f80d7df..c30b38c9 100644 --- a/tests/AppsLab-016-Loops.Tests/WeatherStatsTests.cs +++ b/tests/AppsLab-016-Loops.Tests/WeatherStatsTests.cs @@ -17,6 +17,7 @@ public void Setup() } /// + // /// Test the AverageTemperature method. /// [Test] diff --git a/zivocisny retazec/Animal.cs b/zivocisny retazec/Animal.cs new file mode 100644 index 00000000..1b916fdc --- /dev/null +++ b/zivocisny retazec/Animal.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace zivocisny_retazec +{ + internal class Animal + { + } +} diff --git a/zivocisny retazec/Program.cs b/zivocisny retazec/Program.cs new file mode 100644 index 00000000..3751555c --- /dev/null +++ b/zivocisny retazec/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/zivocisny retazec/zivocisny retazec.csproj b/zivocisny retazec/zivocisny retazec.csproj new file mode 100644 index 00000000..5dc1537a --- /dev/null +++ b/zivocisny retazec/zivocisny retazec.csproj @@ -0,0 +1,11 @@ + + + + Exe + net9.0 + zivocisny_retazec + enable + enable + + +