コード例 #1
0
ファイル: Program.cs プロジェクト: Maidahmahmood/IT-1050
        static void Main(string[] args)
        {

            System.Console.WriteLine("You are creating a course. Press any key to continue...");
            System.Console.ReadKey();
            bool IsCourseCreated = false;
            while (!IsCourseCreated)
            {
                System.Console.WriteLine("Enter the course name");
                string courseName = System.Console.ReadLine();
                System.Console.WriteLine("Enter course number");
                int courseNumber = GetIntegerReply();
                System.Console.WriteLine("How many students are taking  the course");
                int numberOfStudentsInCourse = GetIntegerReply();
                List<Student> students = CreateStudents(numberOfStudentsInCourse);
                Course newCourse = new Course(courseName, courseNumber, students);
                System.Console.WriteLine(System.Environment.NewLine);
                System.Console.WriteLine(newCourse.ProvideCourseInformation());
                System.Console.WriteLine("Here is information of students enrolled in the class:");
                System.Console.WriteLine(newCourse.ProvideStudentsInformation());

                System.Console.WriteLine("Does all information look good? Press Y to exit and N to start over");
                string reviewAnswer = System.Console.ReadLine();
                while (!reviewAnswer.Equals("Y", StringComparison.OrdinalIgnoreCase)
                    && !reviewAnswer.Equals("N", StringComparison.OrdinalIgnoreCase))
                {
                    System.Console.WriteLine("Invalid answer. Try again.");
                    reviewAnswer = System.Console.ReadLine();
                }
                if (reviewAnswer.Equals("Y", StringComparison.OrdinalIgnoreCase))
                    IsCourseCreated = true;
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: aasante0619/Class-IT1050
        static void Main(string[] args)
        {
            Course CourseA = new Course();
            CourseA.PrintCourseInfo();

            CourseA.GetClassInfo();

            System.Console.ReadKey();
        }