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
3 changes: 3 additions & 0 deletions DsaPlayGround/DsaPlayGround.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
</PropertyGroup>

<ItemGroup>
<Compile Remove="PlayGround\MethodOverloading_AssessmentTwo\obj\**" />
<Compile Remove="StackAndQueue\**" />
<EmbeddedResource Remove="PlayGround\MethodOverloading_AssessmentTwo\obj\**" />
<EmbeddedResource Remove="StackAndQueue\**" />
<None Remove="PlayGround\MethodOverloading_AssessmentTwo\obj\**" />
<None Remove="StackAndQueue\**" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace MethodOverloading_AssessmentTwo
{
class Program
{
static void Main()
static void MainEmmanuelAdebayo()
{
try
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;


namespace DayOfTheWeek
{
public enum Days
{
Moday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7,
}
internal class WilliamsAbraham_DaysOfTheWeek
{
static void MainWilliamsAbraham(string[] args)
{
try
{
DaysOfTheWeek(44,44);
}
catch (Exception ex)
{ Console.Write(ex.ToString()); }
}
private static void DaysOfTheWeek(params int [] inputDays)
{
try
{
Dictionary<int, int> daysDictionary = new Dictionary<int, int>();
foreach (int day in inputDays)
{
if (daysDictionary.ContainsKey(day))
{
daysDictionary[day]++;
continue;
}
daysDictionary.Add(day, 1);
}
foreach (var item in daysDictionary.Keys)
{
int freg = daysDictionary[item];
Days eachDay = (Days)item;
bool isValidArgument = Enum.IsDefined(typeof(Days), eachDay);
if (!isValidArgument)
throw new ArgumentException("One of your input is of the wrong format");

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove line

else
Console.WriteLine("Day:{0}, frequency={1}", eachDay, freg);
}
DaysOfTheWeek(inputDays[1]);
}
catch (Exception ex)
{ Console.WriteLine(ex.ToString()); }
}
private static void DaysOfTheWeek(int day)
{
Days inputDay = (Days)day;
bool validArgument = Enum.IsDefined(typeof(Days), inputDay);
if (validArgument)
Console.WriteLine(inputDay);
else
throw new ArgumentException("Invalid input");
}
}
}