// Exercise 1: Where, Select, OrderBy (easy) // // Implement GetAdultNamesSorted so that, given a list of (Name, Age) people, // it returns the names (uppercased) of everyone 18 or older, sorted // alphabetically ascending. Use method-syntax LINQ (Where/Select/OrderBy) — // no manual loops. // // Run with: dotnet run (inside a console project) or paste into a Main method. using System; using System.Collections.Generic; using System.Linq; class Program { #pragma warning disable IDE0060 static List GetAdultNamesSorted(List<(string Name, int Age)> people) { // TODO: filter to Age >= 18, project to uppercased Name, order // ascending alphabetically, and materialize with ToList(). return new List(); } #pragma warning restore IDE0060 static void Main() { int pass = 0, total = 0; var people = new List<(string Name, int Age)> { ("Charlie", 35), ("Bob", 12), ("Alice", 30), ("Dave", 17), ("Eve", 25) }; var result = GetAdultNamesSorted(people); total++; var expected = new List { "ALICE", "CHARLIE", "EVE" }; if (result.SequenceEqual(expected)) { Console.WriteLine("PASS: adult names filtered, uppercased, sorted"); pass++; } else Console.WriteLine("FAIL: adult names filtered, uppercased, sorted, got [" + string.Join(", ", result) + "]"); var empty = GetAdultNamesSorted(new List<(string, int)>()); total++; if (empty.Count == 0) { Console.WriteLine("PASS: empty input yields empty result"); pass++; } else Console.WriteLine("FAIL: empty input yields empty result"); Console.WriteLine($"--- {pass}/{total} checks passed ---"); } }