Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a class called Course that is used to hold the name of a college course a

ID: 3570853 • Letter: C

Question

Create a class called Course that is used to hold the name of a college course and the number of students registered in the course. The problem should be built in three files Course.h, Course.cpp, and main.cpp. I have included the code for main.cpp file below which you should copy and paste into your main.cpp file.

The Course class should have two member variables: myCourseName and myNumberOfStudents. Use a string (not a cstring) for the name and an int for the number.

The class should have a default constructor that sets myCourseName to

Explanation / Answer

Course.h

#include<iostream>

#include<string>

using namespace std;

class Course

{

      private:

              string myCourseName;

              int myNumberOfStudents;

      public:

             Course();

             void SetStudents(int no);

             int GetStudents();

             void SetCourseName(string name)

             string GetCourseName();

             void OuputCourse();

};

Course.cpp

#include "Course.h"

Course::Course()

{

                myCourseName="None Entered";

                myNumberOfStudents=0;

}

void Course::SetStudents(int no)

{

     myNumberOfStudents=no;

}

int Course::GetStudents()

{

    return myNumberOfStudents;

}

void Course::SetCourseName(string name)

{

     myCourseName=name;

}

string Course::GetCourseName()

{

       return myCourseName;

}

void Course::OuputCourse()

{

     cout<<"Course Name: "<<myCourseName<<" No. of Students: "<< myNumberOfStudents<<endl;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote