Please send questions to st10@humboldt.edu .
#include <iostream>
#include <string>
#include "Student.h"
#include "Prof.h"
#include "Course.h"
using namespace std;

//--------------------------------------------------------
// test_Course.cpp - WARNING, only partial!
//
// Contract: main: void -> int
// Purpose: show that, without overloaded assignment
//          operator, assigning one object to another
//          really DOES make it reference the SAME
//          members when pointers are involved...
//          (AND copy-situations have the same effect)
//
// Examples: not really applicable --- simply shows
//           that, when Course c2 is 
//           assigned Course c1, enrolling a student into c2
//           ALSO enrolls that student into c1
//           too!
//
// by: Sharon M. Tuttle
// last modified: 12-12-03
//--------------------------------------------------------

int main()
{
    string dummy;    // to hold any-character-to-continue... 8-)

    Student s1("Jones", "Anna", 3);
    Student s2("Smith", "Joe", 3);
    Student s3("Nguyen", "Dian", 3);
    Student s4;
    Student s5("Hughes", "Howard", 8);
    Prof p1("Tuttle", "Sharon", "M.", "Dr.", "st10", "Never",
            13.13);
    Prof emptyProf;
    Course c1("CS 131", "Intro to CS", p1);
    Course c2;

    //-----
    // quick basic tests of Course constructors and accessors
    //----

    cout << "QUICK TESTS of Course's constructors and accessors: " 
         << endl;
    cout << "---------------------------------------------------" << endl;
    cout << "the following are 1 is passed, 0 if failed: " << endl;
    cout << ( c1.get_courseNum() == "CS 131") << endl;
    cout << ( c1.get_courseName() == "Intro to CS") << endl;
    cout << ( c1.get_numEnrolled() == 0) << endl;
    cout << ( c1.get_enrolled() == NULL) << endl;
    cout << ( c1.get_instructor() == p1) << endl;
    cout << endl;
    cout << ( c2.get_courseNum() == "") << endl;
    cout << ( c2.get_courseName() == "") << endl;
    cout << ( c2.get_numEnrolled() == 0) << endl;
    cout << ( c2.get_enrolled() == NULL) << endl;
    cout << ( c2.get_instructor() == emptyProf) << endl;

    s1.set_grade(0, 100);
    s1.set_grade(1, 95);
    s1.set_grade(2, 87);
    s3.set_grade(0, 50);
    s3.set_grade(1, 60);
    s3.set_grade(2, 70);

    //-----
    // quick test of new = operator in Student
    //-----

    cout << endl;
    cout << "QUICK TEST of new = operator in Student: " << endl;
    cout << "-----------------------------------------" << endl;
    s4 = s1;
    cout << "Student 4: " << endl;
    cout << "   name should be Anna Jones: " << s4.get_firstName() 
         << " " << s4.get_lastName() << endl;
    cout << "   " << "number of grades should be 3: " 
         << s4.get_numGrades() << endl;
    cout << "   grades should be 100 95 87: ";
    for (int i = 0; i < s4.get_numGrades(); i++)
    {
        cout << s4.get_grade(i) << " ";
    }
    cout << endl << endl;

    cout << "type any letter and enter to continue: ";
    cin >> dummy;

    //-----
    // quick test of Course's enroll member function
    //-----

    cout << endl;

    c1.enroll(s1);
    c1.enroll(s2);

    cout << "QUICK TEST of Course's enroll member function: " << endl;
    cout << "-----------------------------------------------" << endl;
    cout << "the following are 1 if passed, 0 if failed: " << endl;
    cout << (c1.get_numEnrolled() == 2) << endl;
    cout << ( (c1.get_enrolled())[0] == s1) << endl;
    cout << ( (c1.get_enrolled())[1] == s2) << endl;

    cout << "type any letter and enter to continue: ";
    cin >> dummy;

    //-----
    // quick test of Course's remove member function
    //-----

    cout << endl;

    c1.enroll(s3);
    c1.enroll(s4);
    c1.remove(s2);

    cout << "QUICK TEST of Course's remove member function: " << endl;
    cout << "-----------------------------------------------" << endl;
    cout << "the following are 1 is passed, 0 if failed: " << endl;
    cout << (c1.get_numEnrolled() == 3) << endl;
    cout << ( (c1.get_enrolled())[0] == s1) << endl;
    cout << ( (c1.get_enrolled())[1] == s3) << endl;
    cout << ( (c1.get_enrolled())[2] == s4) << endl;

    cout << "type any letter and enter to continue: ";
    cin >> dummy;

    //-----
    // quick test of printRoll member function
    //-----

    cout << endl;
    cout << "-------------------------------" << endl;
    cout << "ROLLS BEFORE ASSIGNMENT: " << endl;
    c1.printRoll();
    c2.printRoll(); 

    cout << "type any letter and enter to continue: ";
    cin >> dummy;    

    //-----
    // ...helping with quick test of Course's = operator
    //-----    

    c2 = c1;

    cout << endl;
    cout << "-------------------------------" << endl;
    cout << "ROLLS AFTER ASSIGNMENT: " << endl;
    c1.printRoll();
    c2.printRoll(); 

    cout << "type any letter and enter to continue: ";
    cin >> dummy;    

    //-----
    // demonstrate need for overloaded = ...
    //-----

    c2.enroll(s5);
    c1.remove(s1);

    cout << endl;
    cout << "-------------------------------" << endl;
    cout << "ROLLS AFTER CHANGES: " << endl;
    cout << "   (enrollment of Howard Hughes in c2," << endl;
    cout << "   (and removal of (first) Anna Jones from c1)" << endl;
    c1.printRoll();
    c2.printRoll(); 

    return 0;
}