Skip to content

Numbers #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Session02/Session02Exercise01/Session02Exercise01.sln
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions Session02/Session02Exercise01/Session02Exercise01/Program.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

</Project>
23 changes: 23 additions & 0 deletions Session02/Session02Exercise01/Session02Exercise02/Program.cs
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

</Project>
25 changes: 25 additions & 0 deletions session03/Session03/Session03.sln
Original file line number Diff line number Diff line change
@@ -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
52 changes: 52 additions & 0 deletions session03/Session03/Session03Nubers/Program.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
8 changes: 8 additions & 0 deletions session03/Session03/Session03Nubers/Session03Nubers.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

</Project>