diff --git a/Session02/Session02Exercise01/Session02Exercise01.sln b/Session02/Session02Exercise01/Session02Exercise01.sln new file mode 100644 index 0000000..2f48c65 --- /dev/null +++ b/Session02/Session02Exercise01/Session02Exercise01.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30413.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Session02Exercise01", "Session02Exercise01\Session02Exercise01.csproj", "{97C3BD0B-6DA0-4F7A-9312-D3D91717C86D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session02Exercise02", "Session02Exercise02\Session02Exercise02.csproj", "{FF584B27-3E2A-4112-B8A2-3F165D4EAEF3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {97C3BD0B-6DA0-4F7A-9312-D3D91717C86D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {97C3BD0B-6DA0-4F7A-9312-D3D91717C86D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {97C3BD0B-6DA0-4F7A-9312-D3D91717C86D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {97C3BD0B-6DA0-4F7A-9312-D3D91717C86D}.Release|Any CPU.Build.0 = Release|Any CPU + {FF584B27-3E2A-4112-B8A2-3F165D4EAEF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FF584B27-3E2A-4112-B8A2-3F165D4EAEF3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FF584B27-3E2A-4112-B8A2-3F165D4EAEF3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FF584B27-3E2A-4112-B8A2-3F165D4EAEF3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {738BCA5B-16ED-4CA3-9FB5-D31BF33DEE4B} + EndGlobalSection +EndGlobal diff --git a/Session02/Session02Exercise01/Session02Exercise01/Program.cs b/Session02/Session02Exercise01/Session02Exercise01/Program.cs new file mode 100644 index 0000000..aea0016 --- /dev/null +++ b/Session02/Session02Exercise01/Session02Exercise01/Program.cs @@ -0,0 +1,17 @@ +using System; + +namespace Session02Exercise01 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + + var integer = 0; + string stringValue = "MyStringValue"; + Console.WriteLine("Integer is " + integer.ToString()); + Console.WriteLine("The value of stringValue is: " + stringValue); + } + } +} diff --git a/Session02/Session02Exercise01/Session02Exercise01/Session02Exercise01.csproj b/Session02/Session02Exercise01/Session02Exercise01/Session02Exercise01.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Session02/Session02Exercise01/Session02Exercise01/Session02Exercise01.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Session02/Session02Exercise01/Session02Exercise02/Program.cs b/Session02/Session02Exercise01/Session02Exercise02/Program.cs new file mode 100644 index 0000000..cbf83f5 --- /dev/null +++ b/Session02/Session02Exercise01/Session02Exercise02/Program.cs @@ -0,0 +1,23 @@ +using System; + +namespace Session02Exercise02 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Do you want to enter your name? (y/n)?"); + var key = Console.ReadKey(); + + if (key.KeyChar == 'n') + return; + + Console.WriteLine("\nEnter your name:"); + var name = Console.ReadLine(); + + Console.WriteLine("Hello, " + name + "!"); + + Console.ReadKey(); + } + } +} diff --git a/Session02/Session02Exercise01/Session02Exercise02/Session02Exercise02.csproj b/Session02/Session02Exercise01/Session02Exercise02/Session02Exercise02.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Session02/Session02Exercise01/Session02Exercise02/Session02Exercise02.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/session03/Session03/Session03.sln b/session03/Session03/Session03.sln new file mode 100644 index 0000000..e800347 --- /dev/null +++ b/session03/Session03/Session03.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30413.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session03Nubers", "Session03Nubers\Session03Nubers.csproj", "{B1DF6ABD-780F-41C5-BF00-5A6401285520}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B1DF6ABD-780F-41C5-BF00-5A6401285520}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B1DF6ABD-780F-41C5-BF00-5A6401285520}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B1DF6ABD-780F-41C5-BF00-5A6401285520}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B1DF6ABD-780F-41C5-BF00-5A6401285520}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A3790709-9AB5-49E2-A23A-837C0A667D35} + EndGlobalSection +EndGlobal diff --git a/session03/Session03/Session03Nubers/Program.cs b/session03/Session03/Session03Nubers/Program.cs new file mode 100644 index 0000000..55d8c41 --- /dev/null +++ b/session03/Session03/Session03Nubers/Program.cs @@ -0,0 +1,52 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.Drawing; + +namespace Session03Nubers +{ + class Program + { + static void Main(string[] args) + { + //Konvertera ett antal siffror i en array. + //Räkna ut det högsta värdet, vilket som är det lägsta värdet och medelvärdet (snitt på alla siffror i arrayen). + Console.WriteLine("Ange ett antal siffror separerat med kommatecken:"); + + var input = Console.ReadLine(); + var inputArray = input.Split(",", StringSplitOptions.RemoveEmptyEntries); + double?[] numberArray = new double?[inputArray.Length]; + int sum = 0; + + + for (int i = 0; i < inputArray.Length; i++) + { + bool parsed = double.TryParse(inputArray[i], out double parsedValue); + + if (parsed == true) // (parsed) är samma sak som (parsed == true) + { + numberArray[i] = parsedValue; + } + + else + { + numberArray[i] = null; + } + + } + + foreach (int number in numberArray) + { + Console.WriteLine("Värde: " + number.ToString()); + + + + sum += number; + + + } + Console.WriteLine("Det högsta värdet är: " + ); + Console.WriteLine("Det lägsta värdet är: " + ); + Console.WriteLine("Medelvärdet är: " + sum / numberArray.Length); + } + } +} diff --git a/session03/Session03/Session03Nubers/Session03Nubers.csproj b/session03/Session03/Session03Nubers/Session03Nubers.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/session03/Session03/Session03Nubers/Session03Nubers.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + +