-
Notifications
You must be signed in to change notification settings - Fork 34
Number app #19
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
Cimeiesh
wants to merge
8
commits into
svenrog:master
Choose a base branch
from
Cimeiesh:numbers
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Number app #19
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
93f6734
Inital commit - session 02
Cimeiesh be9f92b
Inital commit - session 02
Cimeiesh 2c57807
Testing integer
Cimeiesh 09484cf
String test
Cimeiesh 7b4c31e
Merge test and develop
Cimeiesh 404dd23
Session 03 - 01
Cimeiesh 38243f1
Progress number 01
Cimeiesh 790a95d
Progress number 02
Cimeiesh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
| ||
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", "{90D33783-F27C-47B3-928D-EB236817F121}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Session02Execise02", "Session02Execise02\Session02Execise02.csproj", "{A4100873-7111-432C-9C9D-3A2B02B5741E}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session02Exercise03", "Session02Exercise03\Session02Exercise03.csproj", "{143EC31C-40E9-442E-9D3C-27C2617B3033}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session02Exercise04", "Session02Exercise04\Session02Exercise04.csproj", "{CE77F64E-455D-41A9-B510-A7C3F2F891D3}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session02Exercise05", "Session02Exercise05\Session02Exercise05.csproj", "{1FD0DCB2-5043-498B-AAE3-2CAF99478E27}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{90D33783-F27C-47B3-928D-EB236817F121}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{90D33783-F27C-47B3-928D-EB236817F121}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{90D33783-F27C-47B3-928D-EB236817F121}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{90D33783-F27C-47B3-928D-EB236817F121}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{A4100873-7111-432C-9C9D-3A2B02B5741E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{A4100873-7111-432C-9C9D-3A2B02B5741E}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{A4100873-7111-432C-9C9D-3A2B02B5741E}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{A4100873-7111-432C-9C9D-3A2B02B5741E}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{143EC31C-40E9-442E-9D3C-27C2617B3033}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{143EC31C-40E9-442E-9D3C-27C2617B3033}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{143EC31C-40E9-442E-9D3C-27C2617B3033}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{143EC31C-40E9-442E-9D3C-27C2617B3033}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{CE77F64E-455D-41A9-B510-A7C3F2F891D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{CE77F64E-455D-41A9-B510-A7C3F2F891D3}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{CE77F64E-455D-41A9-B510-A7C3F2F891D3}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{CE77F64E-455D-41A9-B510-A7C3F2F891D3}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{1FD0DCB2-5043-498B-AAE3-2CAF99478E27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{1FD0DCB2-5043-498B-AAE3-2CAF99478E27}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{1FD0DCB2-5043-498B-AAE3-2CAF99478E27}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{1FD0DCB2-5043-498B-AAE3-2CAF99478E27}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {E81B455C-C0E0-4277-9839-3E0474FBC01C} | ||
EndGlobalSection | ||
EndGlobal |
22 changes: 22 additions & 0 deletions
22
csharp Project 2020/Session02/Session02Execise02/Program.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
|
||
namespace Session02Execise02 | ||
{ | ||
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("Hello, enter your name:"); | ||
var name = Console.ReadLine(); | ||
|
||
Console.WriteLine("Hello," + name + "!"); | ||
Console.ReadKey(); | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
csharp Project 2020/Session02/Session02Execise02/Session02Execise02.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
19 changes: 19 additions & 0 deletions
19
csharp Project 2020/Session02/Session02Exercise01/Program.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.ToString()); | ||
Console.WriteLine("The value of stringValue is:" + stringValue); | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
csharp Project 2020/Session02/Session02Exercise01/Session02Exercise01.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
87 changes: 87 additions & 0 deletions
87
csharp Project 2020/Session02/Session02Exercise03/Program.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
using System; | ||
|
||
namespace Session02Exercise03 | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
//Binary operation | ||
var additionResult = 1 * 2; | ||
|
||
Console.WriteLine("additionResult " + additionResult.ToString()); | ||
|
||
var incrementResult = ++additionResult; | ||
|
||
Console.WriteLine("IncrementResult " + incrementResult.ToString()); | ||
|
||
var trueValue = true; | ||
|
||
var falseValue = false; | ||
|
||
var andResult = 0b0010 & 0b0100; //0b110; | ||
var orResult = trueValue | falseValue; | ||
var xorResult = trueValue ^ falseValue; | ||
|
||
Console.WriteLine("andResult " + andResult); | ||
Console.WriteLine("orResult " + orResult); | ||
Console.WriteLine("xorResult " + xorResult); | ||
|
||
var moduloResult = 3 % 2; | ||
|
||
Console.WriteLine("ModuloResult " + moduloResult); | ||
|
||
var highInterger = 1000; | ||
var intergerDivisionResult = highInterger / 3; | ||
|
||
// Implicit värdekonvertering till double | ||
var doubleDivisionResult = highInterger / 3.0; | ||
|
||
Console.WriteLine("integerDivisionResult " + intergerDivisionResult); | ||
Console.WriteLine("doubleDivisionResult " + doubleDivisionResult); | ||
|
||
int castIntDivisionResult = (int)(highInterger / 3.0); | ||
|
||
Console.WriteLine("castIntDivisionResult " + castIntDivisionResult); | ||
|
||
var conversionResult = Convert.ToInt32(doubleDivisionResult); | ||
|
||
Console.WriteLine("conversionResult " + doubleDivisionResult); | ||
|
||
|
||
var midpointDivisionResult = 10.0 / 3.0; | ||
|
||
Console.WriteLine("midpointDivisionResult " + midpointDivisionResult); | ||
Console.WriteLine("castToInt " + ((int)midpointDivisionResult).ToString()); | ||
Console.WriteLine("ceiling " + Math.Ceiling(midpointDivisionResult)); | ||
Console.WriteLine("floor " + Math.Floor(midpointDivisionResult)); | ||
Console.WriteLine("round " + Math.Round(midpointDivisionResult, 3)); | ||
|
||
//Det går även att använda sammanslagna operatorer likt följande | ||
additionResult += 2; | ||
additionResult -= 2; | ||
additionResult /= 2; | ||
additionResult *= 2; | ||
|
||
var greaterResult = 5 > 3; | ||
var lesstThanResult = 5 < 3; | ||
var greaterOrEqual = 5 >= 5; | ||
var lessOrEqual = 3 <= 5; | ||
|
||
Console.WriteLine("greaterResult" + greaterResult); | ||
Console.WriteLine("lessThanResult" + lesstThanResult); | ||
Console.WriteLine("greaterOrEqual" + greaterOrEqual); | ||
Console.WriteLine("lessOrEqual" + lessOrEqual); | ||
|
||
var andOperationResult = true && false; | ||
var orOperationResult = true || false; | ||
|
||
Console.WriteLine("andOperationResult" + greaterResult); | ||
Console.WriteLine("orOperationResult" + lesstThanResult); | ||
|
||
|
||
|
||
Console.ReadKey(); | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
csharp Project 2020/Session02/Session02Exercise03/Session02Exercise03.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
35 changes: 35 additions & 0 deletions
35
csharp Project 2020/Session02/Session02Exercise04/Program.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
|
||
namespace Session02Exercise04 | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Console.WriteLine("Ange ålder:"); | ||
|
||
|
||
var input = Console.ReadLine(); | ||
var integer = Convert.ToInt32(input); | ||
|
||
if (integer >= 18) | ||
{ | ||
Console.WriteLine("Du får köpa tobakprodukter"); | ||
|
||
|
||
} | ||
else | ||
{ | ||
Console.WriteLine("Du får inte köpa tobaksprodukter"); | ||
|
||
} | ||
|
||
if (integer >= 40) | ||
{ | ||
Console.WriteLine("Du är också väldigt gammal!"); | ||
} | ||
|
||
|
||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
csharp Project 2020/Session02/Session02Exercise04/Session02Exercise04.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
37 changes: 37 additions & 0 deletions
37
csharp Project 2020/Session02/Session02Exercise05/Program.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
|
||
namespace Session02Exercise05 | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Console.WriteLine("Ange vattentemperatur i grader C:"); | ||
|
||
var input = Console.ReadLine(); | ||
var integer = Convert.ToInt32(input); | ||
|
||
string waterLabel = integer >= 27 ? "Går att bada" : "Går inte att bada"; | ||
|
||
//Samma sak som | ||
//if (integer > 27) | ||
//{ | ||
// waterLabel = "Det går att bada!" | ||
// } | ||
// else | ||
//{ | ||
// waterLabel = "Nej! BADA FÖR FAN INTE!!" | ||
//} | ||
|
||
switch (integer) | ||
{ | ||
//Det går bra att radbyta, men är fular och svårare att läsa | ||
case 1: waterLabel = "går inte att bada alls"; break; | ||
case -3: waterLabel = "Det är 3 minusgrader"; break; | ||
default: /* Här kan man göra något om inget träffar */ break; | ||
|
||
|
||
} | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
csharp Project 2020/Session02/Session02Exercise05/Session02Exercise05.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
42 changes: 42 additions & 0 deletions
42
csharp Project 2020/Session03/Session03exercis01/Session03/Program.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
|
||
namespace Session03 | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
int[] integerValues = new[] { 1, 2, 3 }; | ||
|
||
for (var i = 0; i < integerValues.Length; i++) | ||
{ | ||
var name = nameof(integerValues); | ||
var value = integerValues[i]; | ||
|
||
Console.WriteLine($"Index {i} i arrayen {integerValues} har värdet: {value}"); | ||
|
||
} | ||
var doWhileIndex = 0; | ||
|
||
do | ||
{ | ||
var value = integerValues[doWhileIndex]; | ||
|
||
Console.WriteLine($"Index {doWhileIndex} i arrayen {integerValueName}"); | ||
doWhileIndex++; | ||
} | ||
while (doWhileIndex < integerValues.Length); | ||
|
||
var whileIndex = 0; | ||
|
||
while (whileIndex < integerValues.Length) | ||
{ | ||
var value = integerValues[whileIndex]; | ||
|
||
Console.WriteLine($"While Index {whileIndex} i arrayen {integerValuesName} har värdet {value}"); | ||
|
||
whileIndex++; | ||
} | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
csharp Project 2020/Session03/Session03exercis01/Session03/Session03.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Försök att inte ha för mycket tomutrymme i kodblocken.
}
bör komma redan på rad 18.