Esempio n. 1
0
 private static void SaveGrades(GradeTracker book)
 {
     using (StreamWriter outputFile = File.CreateText("grades.txt"))
     {
         book.WriteGrade(outputFile);
     }
 }
Esempio n. 2
0
        private static void WriteResults(GradeTracker book)
        {
            GradeStatistics stats = book.ComputeStatistics();

            WriteResult("Average", stats.AverageGrade);
            WriteResult("Highest", stats.HighestGrade);
            WriteResult("Lowest", stats.LowestGrade);
            WriteResult(stats.Description, stats.LetterGrade);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            ConsoleInit();
            GradeTracker book = CreateGradeBook();

            //GetBookName(book);
            AddGrades(book);
            SaveGrades(book);
            WriteResults(book);

            Console.ReadLine();
        }
Esempio n. 4
0
 private static void GetBookName(GradeTracker book)
 {
     try
     {
         Console.WriteLine("Enter a name:");
         book.Name = Console.ReadLine();
     }
     catch (ArgumentException ex)
     {
         Console.WriteLine(ex.Message);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Something went wrong.. :(" + ex.Message);
     }
 }
Esempio n. 5
0
 private static void AddGrades(GradeTracker book)
 {
     book.AddGrade(89.5f);
     book.AddGrade(75);
     book.AddGrade(91);
 }