Skip to content
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
8 changes: 8 additions & 0 deletions Enums/Enums.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>netcoreapp2.1</TargetFramework>
</PropertyGroup>

</Project>
41 changes: 41 additions & 0 deletions Enums/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;

namespace Enums
{
class Program
{
static void Main()
{
//days into year that birthday occurs
int myBirthday = 90;
//day of week -1 for 1950
int dayOfWeekTracker = -1;
//promts user to enter a year and stores as int
Console.WriteLine("Enter Year");
int year = Convert.ToInt16(Console.ReadLine());

//increments a counter by 1 on normal years and by 2 on leap years to keep track of week day shift through years
for (int yearCheck = 1950; yearCheck <= year; yearCheck++)
{
//if leap year add two
if(yearCheck%4 == 0)
{
dayOfWeekTracker += 2;
}
//if normal year add 1
else dayOfWeekTracker++;
}
//caculates day of week that birthday lands on
int DayOfWeek = (myBirthday+dayOfWeekTracker)%7;
//writes year and day of week that birthday lands on
Console.WriteLine("year "+ (year)+" " + (DaysOfWeek)(DayOfWeek));
Console.ReadLine();
}

//enum to store days of week as ints
enum DaysOfWeek
{
Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
}
}
}