Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions

Question

7. What four parts are standard in most e-mail message and memos?

Answered: 1 week ago

Question

2. Develop a persuasive topic and thesis

Answered: 1 week ago

Question

1. Define the goals of persuasive speaking

Answered: 1 week ago