Beispiel #1
0
        static void Main(string[] args)
        {
            var stat = new Stats();

            stat.Start();

            Payroll payroll = new Payroll();

            payroll.payAll();



            var adding = true;

            while (adding)
            {
                try
                {
                    var student = new Student();

                    student.Name = Util.Console.Ask("Enter student name:");

                    student.Grade = Util.Console.AskInt("Enter student grade:");

                    student.School = (Schools)Util.Console.AskInt("Enter your school(type the coreesponding number:\n 0:) Hogwarts \n 1:)Harvard \n 2:)MIT ");
                    students.Add(student);
                    Posted?.Invoke();
                    //ShowGrade("haha");
                    Student.Count++;

                    Console.WriteLine("Student count: {0}", Student.Count);

                    Console.WriteLine("Add another student? y/n");

                    if (Console.ReadLine() != "y")
                    {
                        adding = false;
                    }
                }
                catch (FormatException msg)
                {
                    Console.WriteLine(msg.Message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error adding student, try again");
                }
            }



            foreach (var item in students)
            {
                Console.WriteLine($"{item.Name} {item.Grade} {item.School}");
            }
        }