public static void Main(string[] args) { NamesCount namesCount = new NamesCount(); namesCount.AddName("James"); namesCount.AddName("John"); namesCount.AddName("Mary"); namesCount.AddName("Mary"); Console.WriteLine("Fraction of Johns: {0}", namesCount.NameProportion("John")); Console.WriteLine("Fraction of Marys: {0}", namesCount.NameProportion("Mary")); }
public static void Main(string[] args) { NamesCount namesCount = new NamesCount(); namesCount.AddName("John"); namesCount.AddName("Mary"); namesCount.AddName("Mary"); Console.WriteLine("Fraction of Johns: {0:0.000}", namesCount.NameProportion("John")); Console.WriteLine("Fraction of Marys: {0:0.000}", namesCount.NameProportion("Mary")); Console.WriteLine("Total Number of name entries: "+ namesCount.Count); Console.ReadKey(); }
public static void Main() { NamesCount namesCount = new NamesCount(); namesCount.AddName("James"); namesCount.AddName("John"); namesCount.AddName("Mary"); namesCount.AddName("Mary"); Assert.AreEqual(0.25, namesCount.NameProportion("John")); Assert.AreEqual(0.5, namesCount.NameProportion("Mary")); //Console.WriteLine("Fraction of Johns: {0}", namesCount.NameProportion("John")); //Console.WriteLine("Fraction of Marys: {0}", namesCount.NameProportion("Mary")); }