예제 #1
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Kevin's GradeBook");

            book.GradeAdded += OnGradeAdded;
            book.GradeAdded += OnGradeAdded;
            book.GradeAdded -= OnGradeAdded;
            book.GradeAdded += OnGradeAdded;
            EnterGrades(book);



            // book.AddGrade(89.1);
            // book.AddGrade(90.5);
            // book.AddGrade(77.5);

            var stats = book.GetStatistics();

            Console.WriteLine(InMemoryBook.CATEGORY);
            Console.WriteLine($"For the book named {book.Name}");
            Console.WriteLine($"The lowest grade is {stats.Low}");
            Console.WriteLine($"The highest grade is {stats.High}");
            Console.WriteLine($"The average grade is {stats.Average:N1}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
        }
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Polina's Grade Book");

            book.GradeAdded += OnGradeAdded;

            EnterGrades(book);

            // Console.WriteLine("Do you want to enter some grades? (y/n)?");
            // var answer = Console.ReadLine();
            // while (answer == "y")
            // {
            //     Console.WriteLine("Please enter your grade here");
            //     var grade = double.Parse(Console.ReadLine());
            //     book.AddGrade(grade);
            //     Console.WriteLine("Do you want to enter more grades?(y/n)");
            //     answer = Console.ReadLine();
            // }

            var stats = book.GetStatistics();

            Console.WriteLine($"For the book named {book.Name}");
            Console.WriteLine($"The average grade is {stats.Average:N1}");
            Console.WriteLine($"The highest grade is {stats.High}");
            Console.WriteLine($"The lowest grade is {stats.Low}");
            Console.WriteLine($"The letter is {stats.Letter}");
        }
예제 #3
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Harry potter");

            EnterGrade(book);
            var stats = book.GetStatistics();

            Console.WriteLine($"The low grade is {stats.Low}");
            Console.WriteLine($"The high grade is {stats.High}");
            Console.WriteLine($"The result is {stats.Average:N2}");
            Console.WriteLine($"The Grade is {stats.Letter}");
        }
예제 #4
0
        static void Main(string[] args)
        {
            var book = new DiskBook("Jay's grade book");

            book.GradeAdded += OnGradeAdded;
            EnterGrade(book);
            var stats = book.GetStatistics();

            Console.WriteLine($"The average grade is {stats.Average:N1}");
            Console.WriteLine($"The highest grade is {stats.Highest:N1}");
            Console.WriteLine($"The lowest grade is {stats.Lowest:N1}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
        }
예제 #5
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("My Grade Book");

            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(77.5);

            var stats = book.GetStatistics();

            Console.WriteLine($"The lowest grade is {stats.Low}");
            Console.WriteLine($"The highest grade is {stats.High}");
            Console.WriteLine($"The average grade is {stats.Avarage}");
        }
예제 #6
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("gradeBook");

            book.GradeAdded += OnGradeAdded;
            EnterGrades(book);

            var stats = book.GetStatistics();

            Console.WriteLine($"Book: {book.Name}");
            Console.WriteLine($"Highest: {stats.High:N1}");
            Console.WriteLine($"Lowest: {stats.Low:N1}");
            Console.WriteLine($"Average: {stats.Average:N1}");
            Console.WriteLine($"Letter: {stats.Letter:N1}");
        }
예제 #7
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Warren's gradeBook");

            book.GradeAdded += OnGradeAdded;
            EnterGrades(book);

            var stats = book.GetStatistics();

            Console.WriteLine($"For the book named {book.Name}");
            Console.WriteLine($"The average grade is {stats.Average:N2}");
            Console.WriteLine($"The highest grade is {stats.High:N2}");
            Console.WriteLine($"The lowest grade is {stats.Low:N2}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
        }
예제 #8
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Ray's Gradebook"); //need a DiskBook class that will implement the IBook interface

            book.GradeAdded += OnGradeAdded;

            EnterGrades(book);

            var stats = book.GetStatistics();

            Console.WriteLine($"For the book named {book.Name}");
            Console.WriteLine($"The lowest grade is {stats.Low:N1}");
            Console.WriteLine($"The highest grade is {stats.High:N1}");
            Console.WriteLine($"The average grade is {stats.Average:N1}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
        }
예제 #9
0
파일: Program.cs 프로젝트: naheemnoah/C-
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Scott's grade book");

            // calling the action on delegate
            book.GradeAdded += OnGradeAdded;

            EnterGrades(book);

            var stats = book.GetStatistics();

            Console.WriteLine($"The average result is {stats.average,1}");
            Console.WriteLine($"The highest grade is {stats.high}");
            Console.WriteLine($"The lowest grade is {stats.low}");
            Console.WriteLine($"The letter grade is {stats.letter}");
        }
예제 #10
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Kuchlong's book");

            book.GradeAdded += onGradeAdded;
            book.GradeAdded += onGradeAdded;

            EnterGrade(book);
            var result = book.GetStatistics();

            Console.WriteLine($"this book is for   {book.Name}");
            Console.WriteLine($"the lowest grade is {result.Low}");
            Console.WriteLine($"the highest grade is {result.High}");
            Console.WriteLine($"the average grade is {result.Average:N1}");
            Console.WriteLine($"the average grade  is {result.Letter}");
        }
예제 #11
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("My book");

            book.GradeAdded += OnGradeAddded;

            EnterGrades(book);

            var stats = book.GetStatistics();

            Console.WriteLine($"For the book named {book.Name}");
            Console.WriteLine($"Lowest grade: {stats.Low}");
            Console.WriteLine($"Highest grade: {stats.High}");
            Console.WriteLine($"Average grade: {stats.Average}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
        }
예제 #12
0
        static void Main(string[] args)
        {
            var book = new DiskBook("gradebook");

            book.GradeAdded += OnGradeAdded;

            EnterGrades(book);

            var statistics = book.GetStatistics();

            Console.WriteLine($"The grade book name is {book.Name}.");
            Console.WriteLine($"The lowest grade is: {statistics.Low:N1}");
            Console.WriteLine($"The highest grade is: {statistics.High:N1}");
            Console.WriteLine($"The average grade is: {statistics.Average:N1}");
            Console.WriteLine($"The average letter grade is: {statistics.Letter}");
        }
예제 #13
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Naj's Grade Book");

            book.GradeAdded += OnGradeAdded;
            // book.AddGrade(44.2);
            // book.AddGrade(99.2);
            // book.AddGrade(22.3);
            EnterGrades(book);
            Statistics stats = book.GetStatistics();

            Console.WriteLine($"For the book named {book.Name}");
            Console.WriteLine($"The lowest grade is {stats.Low:N2}");
            Console.WriteLine($"The highest grade is {stats.High:N2}");
            Console.WriteLine($"The average is {stats.Average:N2}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
        }
예제 #14
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Maths");

            book.GradeAdded += OnGradeAdded;
            book.GradeAdded -= OnGradeAdded; // Removed the previous method.
            book.GradeAdded += OnGradeAdded; // There is only one subscription now.

            //book.AddGrades(args);
            EnterGrade(book);

            var stats = book.GetStatistics();

            Console.WriteLine($"Average grade for {book.Name} is = {stats.Average:N2}");
            Console.WriteLine($"Highest grade in {book.Name} is = {stats.High:N2}");
            Console.WriteLine($"Lowest grade in {book.Name} is = {stats.Low:N2}");
            Console.WriteLine($"The letter grade in {book.Name} is = {stats.Letter}");
        }
예제 #15
0
        static void Main(string[] args)
        {
            // var book = new InMemoryBook("Scott's Grade Book");

            IBook book = new DiskBook("Tom's book");

            book.GradeAdded += OnGradeAdded;

            EnterGrades(book);

            var stats = book.GetStatistics();

            System.Console.WriteLine($"For the book named {book.Name}");
            Console.WriteLine($"The lowest grade is {stats.Low}");
            Console.WriteLine($"The highest grade is {stats.High}");
            Console.WriteLine($"The average grade is {stats.Average}");
            Console.WriteLine($"Letter is {stats.Letter}");
        }
예제 #16
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Scott's Grade Book");

            book.GradeAdded += OnGradeAdded;

            var done = false;

            EnterGrade(book, done);

            var stats = book.GetStatistics();


            Console.WriteLine($"For the bokk named: {book.Name}");
            Console.WriteLine($"The highgrade is: {stats.High}\nThe lowest Grade is: {stats.Low}");
            Console.WriteLine($"The average in the grade is {stats.Average:N1}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
        }
예제 #17
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Sebastian's Gradebook");

            book.GradeAdded += OnGradeAdded;

            // prompt user to enter grades and loop until they type 'q' to stop

            EnterGrades(book);

            var stats = book.GetStatistics();

            Console.WriteLine($"For the book named {book.Name}");
            Console.WriteLine($"The lowest grade is {stats.Low}");
            Console.WriteLine($"The highest grade is {stats.High}");
            Console.WriteLine($"The average grade is {stats.Average:N1}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
        }
예제 #18
0
        static void Main(string[] args)
        {
            var book = new DiskBook("Maegan's Grade Book");

            book.GradeAdded += OnGradeAdded;

            EnterGrades(book);
            Console.WriteLine("Entered Grades Complete");

            var statistics = book.GetStatistics();

            Console.WriteLine($"The statistics for the book '{book.Name}' are the following:");
            // Console.WriteLine($"In the {InMemoryBook.CATEGORY} category...");
            Console.WriteLine($"The highest grade is {statistics.HighestGrade}");
            Console.WriteLine($"The lowest grade is {statistics.LowestGrade}");
            Console.WriteLine($"The average grade is {statistics.AverageGrade:N1}");
            Console.WriteLine($"The average letter grade is {statistics.AverageLetterGrade}");

            // misc practice fns

            var practice = new PracticeProblems();
            // practice.run(new[] { "Maegan", "Diana" });
        }