Example #1
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Carol's Grade Book");

            book.GradeAdded += OnGradeAdded;

            EnterGrades(book);

            var stats = book.GetStatistics();

            Console.WriteLine($"For the book {book.Name}");
            Console.WriteLine($"The lowest grade is {stats.LowValue}");
            Console.WriteLine($"The highest grade is {stats.HighValue}");
            Console.WriteLine($"The average grade is {stats.Average:N1}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
        }
Example #2
0
        static void Main()
        {
            Ibook book = new DiskBook("Anton's Grade Book");

            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}");
            Console.WriteLine($"The highest grade is: {stats.High}");
            Console.WriteLine($"The lowest grade is: {stats.Low}");
            Console.WriteLine($"The letter grade is: {stats.Letter}");
        }
Example #3
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("GradeBook");

            book.GradeAdded += OnGradeAdded;

            EnterFiveGrades(book);

            var stats = book.GetStatistics();

            Console.WriteLine($"The highest grade of {book.Name} is {stats.High}");
            Console.WriteLine($"The lowest grade of {book.Name} is {stats.Low}");
            Console.WriteLine($"The average grade of {book.Name} is {stats.Average:N1}");
            Console.WriteLine($"The letter grade of {book.Name} is {stats.Letter}");

            Console.ReadKey();
        }
Example #4
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Dan's Grade DiskBook");

            // Subscribe to an event
            book.GradeAdded += OnGradeAdded;

            EnterGrades(book);

            var stats = book.GetStats();

            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:N2}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
        }
        static void Main(string[] args) // operations on lists
        {
            IBook book = new DiskBook("Book of Stachu");

            book.GradeAdded += OnGradeAdded; //I can add here, becouse there are in one delegation, if I change the type, I cannot do this

            EnterGrades(book);

            var result = book.GetStatistics(); //variation for object that get returned from this function

            //Console.WriteLine($"The category name is: {InMemoryBook.CATEGORY}");//const act like a static member, so I can get to it only by class, not by the object like "book"
            Console.WriteLine($"The name of studnet is: {book.Name}");
            Console.WriteLine($"The highest grade is: {result.High}");
            Console.WriteLine($"The lowest grade is: {result.Low}");
            Console.WriteLine($"The average grade is: {result.Average:N1}"); // N1 means, that it shows 1 digit after decimal numer
            Console.WriteLine($"The letter grade is: {result.Letter}");
        }
Example #6
0
        /* Static members are not associated with an
         * object's instance. Only available through type
         * name of class in which it's defined  */
        static void Main(string[] args)
        {
            // Class instantiation
            IBook book = new DiskBook("Ben's Grade Book");

            book.GradeAdded += OnGradeAdded;

            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:N1}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
        }
Example #7
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Grade Book");

            book.GradeAdded += OnGradeAdded;

            EnterGrades(book);

            var stats = book.GetStatistics();

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

            book.GradeAdded += OnGradeAdded;

            EnterGrades(book);

            var stats = book.GetStatistics();

            Console.WriteLine($"Highest grade is {stats.High}");
            Console.WriteLine($"Lowest grade is {stats.Low}");
            Console.WriteLine($"Average grade si {stats.Average:N1}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
            Console.WriteLine(stats.Letter);
            Console.ReadKey();
        }
Example #9
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Erdi's book of wonder");

            book.GradeAdded += OnGradeAdded;


            EnterGrades(book);

            var stats = book.GetStatistics();

            Console.WriteLine($"For the book named {book.Name}");
            Console.WriteLine($"Highest Grade {stats.High:N1}");
            Console.WriteLine($"Lowest Grade {stats.Low:N1}");
            Console.WriteLine($"Average is {stats.Average:N1}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
        }
        static void Main(string[] args)
        {
            IBook book  = new InMemoryBook("Ben's Grade Book");
            IBook dbook = new DiskBook("test book disk");

            book.GradeAdded += OnGradeAdded;

            EnterGrades(book);

            var stats = book.GetStatistics();

            Console.WriteLine($"For the book named {book.Name}");
            Console.WriteLine($"The lowest grade is {stats.lowGrade}.");
            Console.WriteLine($"The highest grade is {stats.highGrade}.");
            Console.WriteLine($"The average grade is {stats.average:N1}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
        }
Example #11
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Chris' Gradebook of Dark Magic");

            book.GradeAdded += OnGradeAdded;

            EnterGrades(book);

            var stats = book.GetStatistics();


            Console.WriteLine($"For the GradeBook named {book.Name}:");
            Console.WriteLine($"The average grade is {stats.Average:N3}.");
            Console.WriteLine($"The highest grade is {stats.High:N3}.");
            Console.WriteLine($"The lowest grade is {stats.Low:N3}.");
            Console.WriteLine($"The letter grade is {stats.Letter}.");
        }
Example #12
0
        static void Main(string[] args)
        {
            // var book = new InMemoryBook("Benjamin Bowen's Gradebook");
            var book = new DiskBook("Benjamin Bowen's Gradebook");

            book.GradeAdded += OnGradeAdded; // listen to the event contained in Book.cs

            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:N1}");
            Console.WriteLine($"Letter grade: {stats.Letter}");
        }
Example #13
0
        static void Main(string[] args)
        {
            Statistics stats;
            //InMemoryBook book = new InMemoryBook("MathGradeBook");
            DiskBook book = new DiskBook("MathGradeBook");

            book.GradeAdded += OnGradeAdded;

            EnterGrades(book);

            stats = book.GetStatistics();

            Console.WriteLine($"The maximum grade is {stats.High:n1}");
            Console.WriteLine($"The minimum grade is {stats.Low:n1}");
            Console.WriteLine($"The average grade is {stats.Average:n1}");
            Console.WriteLine($"The letter grade is {stats.Letter:n1}");
        }
Example #14
0
        static void Main(string[] args)
        {
            // IBook book = new InMemoryBook("Grades");
            IBook book = new DiskBook("Grades");

            book.GradeAdded += OnGradeAdded; // cannot assign directly to event

            Console.WriteLine("Hello there...\nPlease enter a grade value or enter 'q' to quit:");

            EnterGrades(book);

            if (book.GetGrades().Count > 0)
            {
                Statistics stats = book.GetStatistics();
                Console.WriteLine($"Average: {stats.Average:N1}\nHighest: {stats.High}\nLowest: {stats.Low}\nLetter grade: {stats.Letter}");
            }
        }
Example #15
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Scott's Grade Book");

            book.GradeAdded += OnGradeAdded;

            Console.WriteLine("Please enter a grade. Type q to stop:");
            EnterGrades(book);

            var stats = book.GetStats();

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

            //applying a method to the book delegate
            book.GradeAdded += OnGradeAdded;
            EnterGrades(book);

            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.Average:N2}");
            Console.WriteLine($"the letter grade is {stats.Letter}");

            //Console.WriteLine($"The average grade is {average:N2}%");
        }
Example #17
0
        static void Main(string[] args)
        {
            var book = new DiskBook("Grade Book One");

            book.GradeAdded += OnGradeAdded; // event

            EnterGrades(book);

            var stats = book.GetStatistics();

            Console.WriteLine($"The category is {InMemoryBook.CATEGORY}");
            Console.WriteLine($"The lowest grade is {stats.Low}");
            Console.WriteLine($"The highest grade is {stats.High}");
            Console.WriteLine($"The average grade is {stats.Average:N2}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
            Console.WriteLine($"The name of the book is {book.Name}");
        }
Example #18
0
        static void Main(string[] args)
        {
            var book = new DiskBook("Grade Book");

            book.GradeAdded += OnGradeAdded;
            // book.AddGrade(50.5);
            // book.AddGrade(1.1);
            // book.AddGrade(99.1);

            Console.WriteLine("Enter Grades to add to the book, or q to show stats and quit");
            EnterGrades(book);

            var stats = book.GetStatistics();

            Console.WriteLine($"Average Grade is {stats.Average:N1}");
            Console.WriteLine($"Average Letter Grade is {stats.Letter}");
        }
Example #19
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Dilips GradeBook"); // new book  invokes  the constructor Book() Method when its initilized

            book.GradeAdded += OnGradeAdded;

            EnterGrade(book);

            //Static members belong to the class  only , not to its copies (object instance), instance members are not duplicated in the memory.
            //anything static is not associated with the object, it kinda defeeats the purpose of OOP.

            var stats = book.GetStatistics();  //returns a class object

            System.Console.WriteLine($"HighestGrade is:  {stats.High}");
            System.Console.WriteLine($"LowestGrade is:  {stats.Low}");
            System.Console.WriteLine($"AverageGrade is:  {stats.Average}");
            System.Console.WriteLine($"THe letter grade is is:  {stats.Letter}");
Example #20
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Ryan's Grade Book");

            book.GradeAdded += OnGradeAdded;

            // Add user input from terminal
            EnterGrades(book);

            var stats = book.GetStatistics();

            System.Console.WriteLine($"For the book named {book.Name}");
            System.Console.WriteLine($"The lowest grade is {stats.Low:N1}");
            System.Console.WriteLine($"The highest grade is {stats.High:N1}");
            System.Console.WriteLine($"The average grade is {stats.Average:N1}");
            System.Console.WriteLine($"The letter grade is {stats.Letter}");
        }
        static void Main(string[] args)
        {
            Console.WriteLine("enter name of grade book student");
            var   name = Console.ReadLine();
            IBook book = new DiskBook(name);

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

            var stats = book.GetStatistics();

            System.Console.WriteLine($"For the book named: {book.Name}");
            Console.WriteLine($"The average grade is {stats.Average:N1}");
            Console.WriteLine($"The highest grade {stats.High:N1}");
            Console.WriteLine($"The lowest {stats.Low:N1}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
        }
Example #22
0
        //method
        static void Main(string[] args)
        {
            //instantiaiting the book which mean creating a new object using the new keyword
            var book = new DiskBook("Faith's Grade Book ");

            book.GradeAdded += OnGradAdded;

            EnterGrades(book);

            var stats = book.GetStatistics();

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

            book.gradeAdded += oneGradeAdded;

            EnterGrade(book);

            var result = book.getStatistics();

            Console.WriteLine($"For the book named {book.Name}");
            Console.WriteLine($"The highest Grade is {result.high}");
            Console.WriteLine($"The Lowest Grade is {result.low }");
            Console.WriteLine($"The average grade is {result.average:N2}");
            Console.WriteLine($"The letter grade is {result.letter}");
        }
Example #24
0
        static void Main(string[] args)
        {
            Ibook book = new DiskBook("George's Grade Book");

            book.GradeAdded += OnGradeAdded;

            bool done = false;

            done = EnterGrades(book, done);

            Statistics 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.Average:N2}");
            Console.WriteLine($"The letter is {stats.letter}");
        }
Example #25
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Anelisa's Grades InMemoryBook");

            book.GradeAdded += OnGradeAdded;

            EnterGrades(book);

            var stats = book.GetStatistics(); // Ctrl  + . would autocreate the method in the InMemoryBook class

            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 of the values is {stats.Average:N1}!");
            Console.WriteLine($"The letter grade is {stats.Letter}");
            Console.ReadLine();
        }
Example #26
0
        static void Main()

        {
            Console.WriteLine("Enter a students name");
            var name = Console.ReadLine();
            var book = new DiskBook(name);

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

            var stats = book.GetStatistics();

            Console.WriteLine($"The book name is {book.Name}");
            Console.WriteLine($"Highest grade is {stats.High}");
            Console.WriteLine($"Lowest grade is {stats.Low}");
            Console.WriteLine($"Average grade is {stats.Average}");
            Console.ReadKey();
        }
Example #27
0
        static void Main(string[] args)
        {
            var book = new DiskBook("Gradebook");

            //book.WriteLog("fish and grits");

            book.GradeAdded += OnGradeAdded;

            book.Name = "";

            Console.WriteLine(book.Name);
            EnterGrades(book);

            var stats = book.GetStatistics();

            Console.WriteLine($"Average grade is {stats.Average}.  Low grade is {stats.Low}.  High grade is {stats.High}. " +
                              $"Letter grade is {stats.Letter}");
        }
Example #28
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("My Gradebook");

            //do while loop to ask for book name?
            book.GradeAdded += OnGradeAdded; // things listening/subscribed to event, can only use += or -=

            EnterGrades(book);


            var stats = book.GetStats();


            Console.WriteLine($"For the book named {book.Name}:");
            Console.WriteLine($"Avg: {stats.Average:N1} | High Grade: {stats.High} | Low Grade: {stats.Low}");
            Console.WriteLine($"The average letter grade is: {stats.Letter}");
            //refactoring, unit test forces improvement in code
        }
Example #29
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Ace book");

            book.GradeAdded += OnGradeAdded;
            // Book.AddGrade(89.1);
            // Book.AddGrade(90.5);
            // Book.AddGrade(77.5);

            EnterGrades(book);

            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.Average:N2}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
        }
Example #30
0
        static void Main(string[] args)
        {
            IBook book = new DiskBook("Maycon Brito");

            book.GradeAdded += OnGradeAdded;
            book.GradeAdded += OnGradeAdded;
            book.GradeAdded -= OnGradeAdded;
            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:N3}");
            Console.WriteLine($"The highest grade is {stats.High:N3}");
            Console.WriteLine($"The average grade is {stats.Average:N3}");
            Console.WriteLine($"The letter grade is {stats.Letter}");
        }