Ejemplo n.º 1
0
 private static void SaveGrades(IGradeTrackes book)
 {
     using (StreamWriter outputFile = File.CreateText("grades.txt"))
     {
         book.WriteGrades(outputFile);//if i use like this(methods with using keyword) i dont have to use file close method.
         //outputFile.Close();//it otomaticaly close by its self.
     }
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            IGradeTrackes book = CreateGradeBook();

            GetBookName(book);
            AddGrade(book);
            SaveGrades(book);
            WriteResults(book);
        }
Ejemplo n.º 3
0
        private static void WriteResults(IGradeTrackes book)
        {
            GradeStatistics statistics = book.ComputeStatistics();

            Console.WriteLine("Grades:");
            foreach (float grade in book)
            {
                Console.WriteLine(grade);
            }
            WriteResult("Average:", statistics.AverageGrade);
            WriteResult("Highest:", statistics.HighestGrade);
            WriteResult("Lowest:", statistics.LowestGrade);
            WriteResult(statistics.Description, statistics.LetterGrade);
        }
Ejemplo n.º 4
0
 private static void GetBookName(IGradeTrackes book)
 {
     Console.WriteLine(book.Name);
 }
Ejemplo n.º 5
0
 private static void AddGrade(IGradeTrackes book)
 {
     book.AddGrade(70);
     book.AddGrade(75.8f);
     book.AddGrade(48);
 }