public void TestAverageOfGrades() { GradeRegister register = new GradeRegister(); register.AddGradeBasedOnPoints(51); register.AddGradeBasedOnPoints(50); register.AddGradeBasedOnPoints(49); Assert.AreEqual(Math.Round(Convert.ToDouble("0.67", System.Globalization.CultureInfo.InvariantCulture), 2), register.AverageOfGrades(), "The average should be from all the grades"); }
public void TestAverageOfPoints() { GradeRegister register = new GradeRegister(); register.AddGradeBasedOnPoints(51); register.AddGradeBasedOnPoints(50); register.AddGradeBasedOnPoints(49); Assert.AreEqual(50, register.AverageOfPoints(), "The average should be from all the grades"); }
public static void Main(string[] args) { GradeRegister register = new GradeRegister(); register.AddGradeBasedOnPoints(93); register.AddGradeBasedOnPoints(91); register.AddGradeBasedOnPoints(92); Console.WriteLine(register.AverageOfPoints()); UserInterface ui = new UserInterface(register); ui.Start(); }
public void TestAverageOfPointsLarger() { GradeRegister register = new GradeRegister(); register.AddGradeBasedOnPoints(51); register.AddGradeBasedOnPoints(50); register.AddGradeBasedOnPoints(51); register.AddGradeBasedOnPoints(50); register.AddGradeBasedOnPoints(51); register.AddGradeBasedOnPoints(50); register.AddGradeBasedOnPoints(51); register.AddGradeBasedOnPoints(50); register.AddGradeBasedOnPoints(49); Assert.AreEqual(Math.Round(Convert.ToDouble("50.33", System.Globalization.CultureInfo.InvariantCulture), 2), register.AverageOfPoints(), "The average should be rounded to two decimals"); }
public void ReadPoints() { while (true) { Console.WriteLine("Points:"); string input = Console.ReadLine(); if (input == "") { break; } int score = Convert.ToInt32(input); if (score < 0 || score > 100) { Console.WriteLine("Impossible number."); continue; } register.AddGradeBasedOnPoints(score); } }