Esempio 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.
     }
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            IGradeTrackes book = CreateGradeBook();

            GetBookName(book);
            AddGrade(book);
            SaveGrades(book);
            WriteResults(book);
        }
Esempio 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);
        }
Esempio n. 4
0
 private static void GetBookName(IGradeTrackes book)
 {
     Console.WriteLine(book.Name);
 }
Esempio n. 5
0
 private static void AddGrade(IGradeTrackes book)
 {
     book.AddGrade(70);
     book.AddGrade(75.8f);
     book.AddGrade(48);
 }