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. } }
static void Main(string[] args) { IGradeTrackes book = CreateGradeBook(); GetBookName(book); AddGrade(book); SaveGrades(book); WriteResults(book); }
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); }
private static void GetBookName(IGradeTrackes book) { Console.WriteLine(book.Name); }
private static void AddGrade(IGradeTrackes book) { book.AddGrade(70); book.AddGrade(75.8f); book.AddGrade(48); }