Skip to content
Open
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
26 changes: 16 additions & 10 deletions csharp-fundamentals-maps.Main/Core.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand Down Expand Up @@ -48,11 +49,8 @@ in the createPerson method

public string getValue(string key)
{


return string.Empty;


Dictionary<string, string> person = createPerson();
return person[key];
}

//TODO: 2. Modify below method named hasKey that accepts two parameters:
Expand All @@ -64,6 +62,10 @@ in the provided dictionary
*/
public bool hasKey(Dictionary<string,string> dictionary, string isitthere)
{
if (dictionary.ContainsKey(isitthere))
{
return true;
}
return false;

}
Expand All @@ -78,8 +80,11 @@ public bool hasKey(Dictionary<string,string> dictionary, string isitthere)
*/
public int getValueOrDefault(Dictionary<string,int> dictionary, string isitthere)
{
return 0;

if (dictionary.ContainsKey(isitthere))
{
return dictionary[isitthere];
}
return -1;
}


Expand All @@ -104,9 +109,10 @@ public List<string> buildSecretPhrase(int[] numbers)
map.Add(7, "muse");
map.Add(96, "nice");
// Write your code below this comment...



foreach (int element in numbers)
{
results.Add(map[element]);
}
// // ...and above this comment
return results;
}
Expand Down
Loading