예제 #1
0
    //********************************************
    // Test scaffold.
    //
    static void Main()
    {
        // We need a CourseCatalog object to test the Faculty class

        CourseCatalog catalog = new CourseCatalog("CourseCatalog.dat", "Prerequisites.dat");

        catalog.ReadCourseCatalogData();
        catalog.ReadPrerequisitesData();

        // We also need a ScheduleOfClasses object.

        ScheduleOfClasses schedule = new ScheduleOfClasses("SoC_SP2009.dat", "SP2009");

        schedule.ReadScheduleData(catalog);

        //  Create a Faculty object.

        Faculty faculty = new Faculty("Faculty.dat", "TeachingAssignments.dat");

        //  Read Faculty data from input file.

        faculty.ReadFacultyData();
        faculty.ReadAssignmentData(schedule);

        // Display information about the faculty.

        faculty.Display();
    }
예제 #2
0
    static void Main()
    {
        //  Create CourseCatalog, ScheduleOfClasses, and Faculty objects.
        //  The order of creation is important because a ScheduleOfClasses
        //  needs a CourseCatalog object to properly initialize and a
        //  Faculty object needs a ScheduleOfClasses object.

        //  Create a CourseCatalog object and read data from input files.

        CourseCatalog catalog = new CourseCatalog("CourseCatalog.dat", "Prerequisites.dat");

        catalog.ReadCourseCatalogData();
        catalog.ReadPrerequisitesData();

        //  Create a ScheduleOfClasses object and read data from input file.

        ScheduleOfClasses schedule = new ScheduleOfClasses("SoC_SP2009.dat", "SP2009");

        schedule.ReadScheduleData(catalog);

        //  Create a Faculty object and read data from input files.

        Faculty faculty = new Faculty("Faculty.dat", "TeachingAssignments.dat");

        faculty.ReadFacultyData();
        faculty.ReadAssignmentData(schedule);

        // We'll handle the students differently:  that is,
        // rather than loading them all in at application outset,
        // we'll pull in the data that we need just for one
        // Student when that Student logs on -- see the Student
        // class constructor for the details.

        // Let's temporarily create Students this way as a test,
        // to simulate Students logging on.  Note that only the
        // first Student has "preregistered" for courses based
        // on the content of his/her Student data file (see Student.cs
        // for details). Initial Student data is read from the
        // Student data files.

        Student s1 = new Student("111-11-1111.dat");

        s1.ReadStudentData(schedule);

        Student s2 = new Student("222-22-2222.dat");

        s2.ReadStudentData(schedule);

        Student s3 = new Student("333-33-3333.dat");

        s3.ReadStudentData(schedule);

        // Let's have one Student try enrolling in something, so
        // that we can simulate his/her logging off and persisting
        // the enrollment data in the ssn.dat file (see Student.cs
        // for details).

        Section sec = schedule.FindSection("ART101 - 1");

        sec.Enroll(s2);
        s2.WriteStudentData(); // Check contents of 222-22-2222.dat!

        // Let's see if everything got initialized properly
        // by calling various display methods!

        Console.WriteLine("====================");
        Console.WriteLine("Course Catalog:");
        Console.WriteLine("====================");
        Console.WriteLine("");
        catalog.Display();

        Console.WriteLine("====================");
        Console.WriteLine("Schedule of Classes:");
        Console.WriteLine("====================");
        Console.WriteLine("");
        schedule.Display();

        Console.WriteLine("======================");
        Console.WriteLine("Professor Information:");
        Console.WriteLine("======================");
        Console.WriteLine("");
        faculty.Display();

        Console.WriteLine("====================");
        Console.WriteLine("Student Information:");
        Console.WriteLine("====================");
        Console.WriteLine("");
        s1.Display();
        Console.WriteLine("");
        s2.Display();
        Console.WriteLine("");
        s3.Display();
    }
예제 #3
0
    public static void Main(string[] args)
    {
        //creating a test subject
        Console.WriteLine("Testing Faculty 1");
        Faculty f1 = new Faculty();

        f1.FirstName         = "Joe";
        f1.LastName          = "Schmoe";
        f1.Id                = "8675309";
        f1.Title             = "Instructor";
        f1.DateOfEmployement = Convert.ToDateTime("10/20/2019");
        f1.Employer          = "Tri-C";
        f1.YearlySalary      = 60000.42;
        f1.Tenured           = false;

        //Method to see if I can print that info
        f1.Intro();
        f1.Display();

        //It works!
        f1.GrantTenure();
        f1.Display();

        //GrantTenure() works too!
        //creating test subjects to see if Promote() works

        Faculty f2 = new Faculty();

        Console.WriteLine("Testing Faculty 2");
        f2.FirstName         = "Joe";
        f2.LastName          = "Dirt";
        f2.Id                = "90210";
        f2.Title             = "Instructor";
        f2.DateOfEmployement = Convert.ToDateTime("10/20/2018");
        f2.Employer          = "Tri-C";
        f2.YearlySalary      = 40000.42;
        f2.Tenured           = false;
        f2.Promote();
        f2.Display();


        Faculty f3 = new Faculty();

        Console.WriteLine("Testing Faculty 3");
        f3.FirstName         = "Joe";
        f3.LastName          = "Blow";
        f3.Id                = "1800555";
        f3.Title             = "Instructor";
        f3.DateOfEmployement = Convert.ToDateTime("10/20/2015");
        f3.Employer          = "Tri-C";
        f3.YearlySalary      = 80000.42;
        f3.Tenured           = false;
        f3.Promote();
        f3.Display();

        Faculty f4 = new Faculty();

        Console.WriteLine("Testing Faculty 4");
        f4.FirstName         = "Joe";
        f4.LastName          = "Mama";
        f4.Id                = "1134";
        f4.Title             = "Instructor";
        f4.DateOfEmployement = Convert.ToDateTime("10/20/1990");
        f4.Employer          = "Tri-C";
        f4.YearlySalary      = 180000.42;
        f4.Tenured           = false;
        f4.Promote();
        f4.Display();

        Faculty f5 = new Faculty();

        Console.WriteLine("Testing Faculty 5");
        f5.FirstName         = "Joe";
        f5.LastName          = "Seff";
        f5.Id                = "4200";
        f5.Title             = "Instructor";
        f5.DateOfEmployement = Convert.ToDateTime("10/20/1989");
        f5.Employer          = "Tri-C";
        f5.YearlySalary      = 1180000.42;
        f5.Tenured           = false;
        f5.Promote();
        f5.Display();
    }