Skip to content

Numbers app #14

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 17 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
25 changes: 25 additions & 0 deletions HolidayQuiz/HolidayQuiz.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.30330.147
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HolidayQuiz", "HolidayQuiz\HolidayQuiz.csproj", "{62C58643-5110-40F8-ACEA-6A77D2DD4F95}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{62C58643-5110-40F8-ACEA-6A77D2DD4F95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{62C58643-5110-40F8-ACEA-6A77D2DD4F95}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62C58643-5110-40F8-ACEA-6A77D2DD4F95}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62C58643-5110-40F8-ACEA-6A77D2DD4F95}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AB8B192F-60E4-434F-A590-C946DE0A6AE5}
EndGlobalSection
EndGlobal
8 changes: 8 additions & 0 deletions HolidayQuiz/HolidayQuiz/HolidayQuiz.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>
12 changes: 12 additions & 0 deletions HolidayQuiz/HolidayQuiz/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace HolidayQuiz
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
8 changes: 8 additions & 0 deletions Session02/Exercise01/Exercise01.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>
23 changes: 23 additions & 0 deletions Session02/Exercise01/Nameprogram.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;

namespace Exercise01
{
class Nameprogram
{
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("Enter your name:");
var name = Console.ReadLine();

Console.WriteLine("Hello, " + name);
Console.ReadKey();

}
}
}
31 changes: 31 additions & 0 deletions Session02/Session02.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.30330.147
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Session02Exercise01", "Session02Exercise01\Session02Exercise01.csproj", "{7AD8F7EE-EE2F-4406-83B8-175E47A055BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exercise01", "Exercise01\Exercise01.csproj", "{A006EB6B-4575-4218-8515-908D59C38027}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7AD8F7EE-EE2F-4406-83B8-175E47A055BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7AD8F7EE-EE2F-4406-83B8-175E47A055BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7AD8F7EE-EE2F-4406-83B8-175E47A055BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7AD8F7EE-EE2F-4406-83B8-175E47A055BA}.Release|Any CPU.Build.0 = Release|Any CPU
{A006EB6B-4575-4218-8515-908D59C38027}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A006EB6B-4575-4218-8515-908D59C38027}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A006EB6B-4575-4218-8515-908D59C38027}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A006EB6B-4575-4218-8515-908D59C38027}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A01846C8-7967-4D9C-BFB6-B277CE9B5BFB}
EndGlobalSection
EndGlobal
16 changes: 16 additions & 0 deletions Session02/Session02Exercise01/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;

namespace Session02Exercise01
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");


Console.ReadLine();

}
}
}
8 changes: 8 additions & 0 deletions Session02/Session02Exercise01/Session02Exercise01.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>
25 changes: 25 additions & 0 deletions 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.30330.147
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session03Exercise02", "Session03Exercise02\Session03Exercise02.csproj", "{AC8EF63F-B225-4D1A-AB4E-0DED2349D8CD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AC8EF63F-B225-4D1A-AB4E-0DED2349D8CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AC8EF63F-B225-4D1A-AB4E-0DED2349D8CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC8EF63F-B225-4D1A-AB4E-0DED2349D8CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC8EF63F-B225-4D1A-AB4E-0DED2349D8CD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F9EA986A-D463-4C01-AAE3-D2F92EF01A3C}
EndGlobalSection
EndGlobal
79 changes: 79 additions & 0 deletions Session03/Session03Exercise02/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;

namespace Session03Exercise02
{
class Program
{
static string line = "--------------------------------------------------------------";

static void Main(string[] args)
{
while (true)//Forever and ever n ever
{
Console.WriteLine("Ange ett antal siffror, separat med kommatecken.");
Console.WriteLine(line);

var inputStringArray = Console.ReadLine().Split(',', StringSplitOptions.RemoveEmptyEntries);//new [] för FrameWork
List<double> numbersList = new List<double>(); //A list so I dont need to sort unparsed values in for

double sum = 0;
double maxValue;
double minValue;

int parseNumberCount = 0; //counter for divison with sum for middlevalue

Console.WriteLine(line);
//Input
for (int i = 0; i < inputStringArray.Length; i++)
{
var label = "Värdet är:";
var paddedLabel = label.PadRight(14);

try
{
double currentNumber;
NumberStyles numberStyles = NumberStyles.Any | NumberStyles.Float; //bitwiseoperator
bool parsed = double.TryParse(inputStringArray[i], numberStyles, CultureInfo.InvariantCulture, out currentNumber);
if (!parsed) //Jumps backs to the start of the iteration
continue;
else //Add elements to list and
{
numbersList.Add(currentNumber);
sum += currentNumber;
++parseNumberCount;//Perhaps exsessive in this stage
}
Console.WriteLine(paddedLabel + currentNumber); //Prints out inputvalue for user if correct
// Debug.Assert(i < numbers.Length - 1); //Remainer just for deeper studies in the subject
}
catch (Exception ex)
{
Console.WriteLine(ex);
throw;
}

}
//Assigning highest and smallest value if element in list is not zero
if (numbersList.Count != 0)
{
maxValue = numbersList.Max();
minValue = numbersList.Min();

//Printing out evaluated values
Console.WriteLine(line); Console.WriteLine();
Console.WriteLine($"Högsta värdet: {maxValue}");//Max value
Console.WriteLine($"Minsta värdet: {minValue}");//Min value
Console.WriteLine("Medelvärdet för arrayen är: " + string.Format($"{(sum / parseNumberCount):0.00}")); //Middle value
}
else Console.WriteLine("Här har det inte skrivits in nått värde alls. Försök igen!");//ERROR message
Console.WriteLine("\nTryck på valfri tangent för att köra programmet en gång till.");

Console.ReadKey();
}
}
}
}
8 changes: 8 additions & 0 deletions Session03/Session03Exercise02/Session03Exercise02.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>
25 changes: 25 additions & 0 deletions Session2/Session02/Session02.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.30330.147
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session02Exercise01", "Session02Exercise01\Session02Exercise01.csproj", "{D43377BC-B59A-4BC3-9C2B-E8A1E15DECC3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D43377BC-B59A-4BC3-9C2B-E8A1E15DECC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D43377BC-B59A-4BC3-9C2B-E8A1E15DECC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D43377BC-B59A-4BC3-9C2B-E8A1E15DECC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D43377BC-B59A-4BC3-9C2B-E8A1E15DECC3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BE13223B-EA03-4564-8DF3-0ADFF6760509}
EndGlobalSection
EndGlobal
19 changes: 19 additions & 0 deletions Session2/Session02/Session02Exercise01/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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);
Console.WriteLine("value of my stringvalue: " + 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>
1 change: 1 addition & 0 deletions csharp-plus-2020
Submodule csharp-plus-2020 added at f0bd65
1 change: 1 addition & 0 deletions sharp_projects
Submodule sharp_projects added at dfb7d6
1 change: 1 addition & 0 deletions srctreeclone
Submodule srctreeclone added at 217703