diff --git a/csharp-fundamentals-methods.Main/Core.cs b/csharp-fundamentals-methods.Main/Core.cs index a69b542..b7d30fa 100644 --- a/csharp-fundamentals-methods.Main/Core.cs +++ b/csharp-fundamentals-methods.Main/Core.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; @@ -27,7 +28,8 @@ logic. See the example below and take some time to break it down and understand //TODO: 1. Create a method that accepts a name and returns a greeting public string greet(string name) { - throw new NotImplementedException(); + string greeting = $"Hello Nathan!"; + return greeting; } //TODO: 2. Increment a number @@ -36,7 +38,8 @@ Complete this method so that it increases the number given by 1 and returns the */ public int increment(int number) { - throw new NotImplementedException(); + int incNumber = number + 1; + return incNumber; } //TODO: 3. Construct a friendly greeting @@ -50,7 +53,8 @@ Complete this method so that it accepts a name as an input and outputs a friendl */ public string happilyGreet(string name) { - throw new NotImplementedException(); + return $"Hi, {name} :)"; + } @@ -70,9 +74,7 @@ Create a method named constructNumberArray that accepts two whole numbers named public int[] constructNumberArray(int lower, int upper) { - int[] resultArray = { }; - - return resultArray; + return Enumerable.Range(lower, upper - lower + 1).ToArray(); } @@ -92,7 +94,15 @@ The number of exclamation marks appended must be determined by the number provid public string shout(string phrase, int number) { - return $""; + + string shoutedPhrase = phrase.ToUpper(); + + for (int i = 0; i < number; i++) + { + shoutedPhrase += "!"; + } + + return shoutedPhrase; }