static void doWork() { //Console.WriteLine(Util.Sum(10, 9, 8, 7, 6, 5, 4, 3, 2, 1)); // Uses parameter list //Console.WriteLine(Util.Sum(2, 4, 6, 8)); // Uses optional parameters //Console.WriteLine(Util.Sum(2, 4, 6)); // Uses optional parameters Console.WriteLine(Util.Sum(2, 4, 6, 8, 10)); // Uses parameter list }
static void doWork() { //Console.WriteLine(Util.Sum(null)); //Console.WriteLine(Util.Sum()); //int total = Util.Sum(10, 9, 8, 7, 6, 5, 4, 3, 2, 1); //Console.WriteLine(total); Console.WriteLine(Util.Sum(2, 4, 6, 8, 10)); }
static void doWork() { Console.WriteLine("This is Lab 11"); //Console.WriteLine(Util.Sum(10, 9, 8, 7, 6, 5, 4, 3, 2, 1)); Console.WriteLine(Util.Sum(2, 4, 6, 8, 10)); Console.WriteLine(Util.Sum(2, 4, 6, 8)); Console.WriteLine(Util.Sum(2, 4, 6, 8, 10, 12, 14)); }
static void doWork() { // Writes the exeption from the Util class to the screen picking up an empty array. This tests the 2nd excetion. //Console.WriteLine(Util.Sum()); // Had to comment out because otherwise the program won't continue. // Writes the exception from the Util class to the screen if value equals null. This tests the 1st exception. //Console.WriteLine(Util.Sum(null)); // Had to comment out because otherwise the program won't continue. // Writes the total of the summed array ensuring the class method is working correctly. //Console.WriteLine(Util.Sum(10, 9, 8, 7, 6, 5, 4, 3, 2, 1)); // Expected total 55 from the paramList. Console.WriteLine(Util.Sum(2, 4, 6, 8, 10)); /* Also works with only 3 arguments using the optional params class method in Util. but if you give it 5, the compiler * chooses the parameter array becuase there are only 4 optional params declared in the Util class.*/ }
static void doWork() { // Console.WriteLine(Util.Sum(null)); // Console.WriteLine(Util.Sum()); Console.WriteLine(Util.Sum(10, 9, 8, 7, 6, 5, 4, 3, 2, 1)); Console.WriteLine(Util.Sum(1)); Console.WriteLine(Util.Sum(1, 2)); Console.WriteLine(Util.Sum(1, 2, 3)); Console.WriteLine(Util.Sum(1, 2, 3, 4)); Console.WriteLine(Util.Sum(1, 2, 3, 4, 5)); }
static void doWork() { //Console.WriteLine(Util.Sum(null)); //Console.WriteLine(Util.Sum()); Console.WriteLine(Util.Sum(10, 9, 8, 7, 6, 5, 4, 3, 2, 1)); Console.WriteLine(Util.Sum(50)); Console.WriteLine(Util.Sum(25, 100)); Console.WriteLine(Util.Sum(56, 84, 79)); Console.WriteLine(Util.Sum(44, 26, 98, 35)); Console.WriteLine(Util.Sum(75, 56, 31, 95, 66)); Console.WriteLine(Util.Sum(1, 2, 3, 4, 5, 6)); }
static void doWork() { //Console.WriteLine(Util.Sum(null)); //Console.WriteLine(Util.Sum()); Console.WriteLine(Util.Sum(10, 9, 8, 7, 6, 5, 4, 3, 2, 1)); Console.WriteLine(Util.Sum(21)); Console.WriteLine(Util.Sum(13, 31)); Console.WriteLine(Util.Sum(7, 45, 67)); Console.WriteLine(Util.Sum(44, 24, 64, 76)); Console.WriteLine(Util.Sum(56, 37, 42, 88, 63)); Console.WriteLine(Util.Sum(91, 14, 53, 65, 87, 48)); }
static void doWork() { Console.WriteLine("This is lab 11."); Console.WriteLine(Util.Sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); //Console.WriteLine("Using parameter list"); Console.WriteLine(Util.Sum(1)); Console.WriteLine(Util.Sum(1, 3)); Console.WriteLine(Util.Sum(1, 3, 5)); Console.WriteLine(Util.Sum(1, 3, 5, 7, 9)); Console.WriteLine("=========================================="); Util util = new Util(); Console.WriteLine(util.Total(5, 8)); }
static void doWork() { //Console.WriteLine(Util.Sum(null)); //Console.WriteLine(Util.Sum()); //Console.WriteLine(Util.Sum(10, 9, 8, 7, 6, 5, 4, 3, 2, 1)); //at runtime overload of Sum method it called because it is most closely matches the method call Console.WriteLine(Util.Sum(2, 4, 6, 8)); //outputs 20 //clr uses method overload which accepts optional parameters once more - it has precedence before params int[] parameter Console.WriteLine(Util.Sum(2, 4, 6)); //outputs 12 //this time there is 5 parameters passed in so CLR takes parameters list overload of Sum method Console.WriteLine(Util.Sum(2, 4, 6, 8, 10)); //outputs 30 }
static void doWork() { Console.WriteLine(Util.Sum(2, 4, 6)); //int[] _paramArray = new int[5] { 2, 4, 6, 8, 10 }; //Console.WriteLine($"Sum is : {Util.Sum(_paramArray).ToString()}"); int m = 0; string _answer = "Y"; string _sentence; while (_answer == "Y") { _sentence = Console.ReadLine(); Console.WriteLine(_sentence.ToLower()); Console.WriteLine("Do you need any more help at this time since I am testing a branch so lets see what happens now also at 2:50 pm"); _answer = Console.ReadLine(); } }
static void doWork() { //Console.WriteLine(Util.Sum(10, 9, 8, 7, 6, 5, 4, 3, 2, 1)); Console.WriteLine(Util.Sum(2, 4, 6, 8, 10)); }
static void doWork() { // Console.WriteLine(Util.Sum(null)); //Console.WriteLine(Util.Sum()); Console.WriteLine(Util.Sum(2, 4, 6, 8, 10)); }
static void doWork() { Console.WriteLine(Util.Sum(2, 4, 6, 8, 10)); }
static void doWork() { Console.WriteLine(Util.Sum(5, 5, 5, 5)); Console.WriteLine(Util.Sum(5, 5, 5)); Console.WriteLine(Util.Sum(5, 5, 5, 5, 5)); }
static void Entrance() { Console.WriteLine(Util.Sum(10, 9, 8, 7, 6, 5, 4, 3, 2, 1)); }
private static void DoWork() { Console.WriteLine(Util.Sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); Console.WriteLine(Util.Sum(1, 2, 3, 4)); }
static void doWork() { int total = Util.Sum(10, 9, 8, 7, 6, 5, 4, 3, 2, 1); Console.WriteLine(total); }
static void doWork() { Console.WriteLine(Util.Sum(15, 12)); }