From eaa68ede983c0967893b22463933a621310d7e99 Mon Sep 17 00:00:00 2001 From: "James.Woodard" Date: Thu, 23 Aug 2018 08:44:42 -0500 Subject: [PATCH 1/2] started working on enum/struct practice --- practice2/.vscode/launch.json | 28 ++++++++++++++++++ practice2/.vscode/tasks.json | 15 ++++++++++ practice2/Days.cs | 0 practice2/Program.cs | 56 +++++++++++++++++++++++++++++++++++ practice2/practice2.csproj | 8 +++++ 5 files changed, 107 insertions(+) create mode 100644 practice2/.vscode/launch.json create mode 100644 practice2/.vscode/tasks.json create mode 100644 practice2/Days.cs create mode 100644 practice2/Program.cs create mode 100644 practice2/practice2.csproj diff --git a/practice2/.vscode/launch.json b/practice2/.vscode/launch.json new file mode 100644 index 00000000..23303620 --- /dev/null +++ b/practice2/.vscode/launch.json @@ -0,0 +1,28 @@ +{ + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/bin/Debug/netcoreapp2.1/practice2.dll", + "args": [], + "cwd": "${workspaceFolder}", + // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window + "console": "internalConsole", + "stopAtEntry": false, + "internalConsoleOptions": "openOnSessionStart" + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" + } + ,] +} \ No newline at end of file diff --git a/practice2/.vscode/tasks.json b/practice2/.vscode/tasks.json new file mode 100644 index 00000000..44bc3e38 --- /dev/null +++ b/practice2/.vscode/tasks.json @@ -0,0 +1,15 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/practice2.csproj" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/practice2/Days.cs b/practice2/Days.cs new file mode 100644 index 00000000..e69de29b diff --git a/practice2/Program.cs b/practice2/Program.cs new file mode 100644 index 00000000..4ce0575c --- /dev/null +++ b/practice2/Program.cs @@ -0,0 +1,56 @@ +using System; + +namespace practice2 +{ + class Program + { + static void Main(string[] args) + { + + //FOR PROJECT USE DATETIME.DAYOFWEEK + Console.WriteLine("Hello World!"); + Console.WriteLine("Sunday is "+(int)Days.Sunday); + Days today = Days.Wednesday; + Days tomorrow = today + 1; + Console.WriteLine("Today is "+today); + Console.WriteLine("Tomorrow is "+tomorrow); + Console.WriteLine("If today is " + today + " tomorrow is "+getNextDay(today)); + } + + + public static Days getNextDay(Days day){ + return day+1; + } + public static bool isWeekend(Days day){ + if (day == Days.Sunday || day == Days.Saturday) + { + return true; + } + else + { + return false; + } + + } + } + + public enum Days { + Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday + } + + + //EXAMPLE FROM THE INNERNETTE + // class Sample + // { + // public static void Main() + // { + // // Assume the current culture is en-US. + // // Create a DateTime for the first of May, 2003. + // DateTime dt = new DateTime(2003, 5, 1); + // Console.WriteLine("Is Thursday the day of the week for {0:d}?: {1}", + // dt, dt.DayOfWeek == DayOfWeek.Thursday); + // Console.WriteLine("The day of the week for {0:d} is {1}.", dt, dt.DayOfWeek); + // } +} +/* +} diff --git a/practice2/practice2.csproj b/practice2/practice2.csproj new file mode 100644 index 00000000..23df6047 --- /dev/null +++ b/practice2/practice2.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.1 + + + From 34b1e1654cfdebdf48a81dad792ee03aaedafe14 Mon Sep 17 00:00:00 2001 From: "James.Woodard" Date: Tue, 28 Aug 2018 12:16:26 -0500 Subject: [PATCH 2/2] finished enum project --- enum/.vscode/launch.json | 28 ++++++++++++++++++++++++++++ enum/.vscode/tasks.json | 15 +++++++++++++++ enum/Program.cs | 37 +++++++++++++++++++++++++++++++++++++ enum/enum.csproj | 8 ++++++++ practice2/Program.cs | 17 +++-------------- 5 files changed, 91 insertions(+), 14 deletions(-) create mode 100644 enum/.vscode/launch.json create mode 100644 enum/.vscode/tasks.json create mode 100644 enum/Program.cs create mode 100644 enum/enum.csproj diff --git a/enum/.vscode/launch.json b/enum/.vscode/launch.json new file mode 100644 index 00000000..6c6b4884 --- /dev/null +++ b/enum/.vscode/launch.json @@ -0,0 +1,28 @@ +{ + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/bin/Debug/netcoreapp2.1/enum.dll", + "args": [], + "cwd": "${workspaceFolder}", + // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window + "console": "internalConsole", + "stopAtEntry": false, + "internalConsoleOptions": "openOnSessionStart" + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" + } + ,] +} \ No newline at end of file diff --git a/enum/.vscode/tasks.json b/enum/.vscode/tasks.json new file mode 100644 index 00000000..2837c53b --- /dev/null +++ b/enum/.vscode/tasks.json @@ -0,0 +1,15 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/enum.csproj" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/enum/Program.cs b/enum/Program.cs new file mode 100644 index 00000000..c842562b --- /dev/null +++ b/enum/Program.cs @@ -0,0 +1,37 @@ +using System; + +namespace enumpractice +{ + class Program + { + public static void Main(string[] args) + { + + Console.WriteLine("Please enter the MONTH you were born in, as a number: "); + string dateMonth = Console.ReadLine(); + int dateMonthInt = Convert.ToInt32(dateMonth); + + Console.WriteLine("Please enter what DAY of the month you were born on, as a number: "); + string dateDay = Console.ReadLine(); + int dateDayInt = Convert.ToInt32(dateDay); + + Console.WriteLine("Please enter ANY YEAR to see what day of the month your birthday lands on in any given year: "); + string dateYear = Console.ReadLine(); + int dateyearInt = Convert.ToInt32(dateYear); + + DateTime dt = new DateTime(dateyearInt, dateMonthInt, dateDayInt); + int dayOfWeekInt = (int)dt.DayOfWeek; + + Console.WriteLine("The day of the week for {0:d} is {1}.", dt, (Days)dayOfWeekInt); + } + } + public enum Days + { + Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday + } + + + +} + + diff --git a/enum/enum.csproj b/enum/enum.csproj new file mode 100644 index 00000000..23df6047 --- /dev/null +++ b/enum/enum.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.1 + + + diff --git a/practice2/Program.cs b/practice2/Program.cs index 4ce0575c..423ac0ad 100644 --- a/practice2/Program.cs +++ b/practice2/Program.cs @@ -39,18 +39,7 @@ public enum Days { } - //EXAMPLE FROM THE INNERNETTE - // class Sample - // { - // public static void Main() - // { - // // Assume the current culture is en-US. - // // Create a DateTime for the first of May, 2003. - // DateTime dt = new DateTime(2003, 5, 1); - // Console.WriteLine("Is Thursday the day of the week for {0:d}?: {1}", - // dt, dt.DayOfWeek == DayOfWeek.Thursday); - // Console.WriteLine("The day of the week for {0:d} is {1}.", dt, dt.DayOfWeek); - // } -} -/* + } + +