Question: Write a C++ program that includes the following: // Course.h #ifndef COURSE_H #define COURSE_H #include #include using namespace std; struct NodeType { string student_name; NodeType*

Write a C++ program that includes the following:

// Course.h #ifndef COURSE_H #define COURSE_H #include  #include  using namespace std; struct NodeType { string student_name; NodeType* next; }; class Course { public: // Default constructor Course(); // Creates a course with the specified name. Course(const string& course_name); // Destructor ~Course(); // Returns the course name. string get_course_name() const; // Adds a new student to the course. void add_student(const string& new_student); // Drops the specified student void drop_student(const string& drop_student); // Returns the pointer of students for the course. NodeType* get_students() const; // Prints the course name and the added students. void print_course() const; private: // The name of the course string course_name; //A collection of students who take the course. students is a pointer which points to a linked structure. NodeType* students; }; #endif 
  • Define the class Student in the header file Course.h.
  • Implement the class Course in the file Course.cpp.
  • The main function is contained in the file lab02.cpp. The main function,
    1. Prompts the user to enter the course name and creates a course.
    2. Prompts the user to enter the student name and add the student in the course, stop adding the students when the user enter "exit" as student name
    3. Prompts the user to enter the student name to be removed, and remove the student from the course.
    4. Displays the course name and students added in the course.

The expected result:

Enter the course name: CSE330 The course is created. Add the students in the course Enter the student name: Taylor The student is added Enter the student name: Jim The student is added Enter the student name: Alice The student is added Enter the student name: exit Enter the student that will be removed: Jim The student is removed The course information: CSE330 Taylor Alice

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!