public static void ConsonentsVowelRatio() { Presidents_Array _Array = new Presidents_Array(); Comparer_Vowel_ConstantRatio _ConstantRatio = new Comparer_Vowel_ConstantRatio(); IEnumerable <string> namesByVToCRatio = _Array.presidents .OrderBy((s => s), _ConstantRatio); foreach (string item in namesByVToCRatio) { int vCount = 0; int cCount = 0; _ConstantRatio.GetVowlConstantCount(item, ref vCount, ref cCount);//gets number of vowels for two strings, and returns the ratio and the comparer number double dRatio = (double)vCount / (double)cCount; Console.WriteLine($"{item} -- {dRatio} -- {vCount} : {cCount}"); } }
public static void ThenByVowelRatio() { Presidents_Array presidents = new Presidents_Array(); Comparer_Vowel_ConstantRatio comparer_Vowel = new Comparer_Vowel_ConstantRatio(); IEnumerable <string> namesByRatio = presidents.presidents .OrderBy(n => n.Length) .ThenBy((s => s), comparer_Vowel); foreach (string item in namesByRatio) { int vCount = 0; int cCount = 0; comparer_Vowel.GetVowlConstantCount(item, ref vCount, ref cCount); double dRatio = (double)vCount / (double)cCount; Console.WriteLine($"{item} - {vCount} - {cCount}"); } }