Question
okay i have this so far... C++ #include using namespace std; class Student { public: Student(); Student(string name, int id); string getName() const; int getID()
okay i have this so far... C++
#include
using namespace std;
class Student {
public:
Student();
Student(string name, int id);
string getName() const;
int getID() const;
void setName(string name);
void setID(int id);
private:
string myName;
int myID;
};
class Course{
public:
Course();
Course(string title, int number, string instructorName);
void printAll() const;
bool add(Student s[]);
bool remove(Student s[] );
int enrolledStudents();
string getTitle() const;
int getNumber() const;
string getInstructorName() const;
private:
string myTitle;
int myNumber;
string myInstructorName;
Student s[30];
int myEnrolledStudents;
};
int main() {
Course c1("Intro to Everything", 123, "Dr. Gross");
Student s1("Jane", 1234);
Student s2("Phillipe", 1235);
Student s3("Lu", 1236);
Student s4("Enrique", 1237);
cout
return 0;
}
Student::Student()
{
myName = "no name";
myID = 000;
}
Student::Student(string name, int id):myName(name), myID(id)
{
myName = name;
myID = id;
}
Course::Course()
{
myTitle = "none";
myNumber = 000;
myInstructorName = "none";
}
Course::Course(string title, int number, string instructorName)
{
myTitle = title;
myNumber = number;
myInstructorName = instructorName;
}
string Student::getName() const
{
return myName;
}
int Student::getID() const
{
return myID;
}
void Student::setName(string name)
{
myName = name;
}
string Course::getTitle() const
{
return myTitle;
}
int Course:: getNumber() const
{
return myNumber;
}
string Course::getInstructorName() const{
return myInstructorName;
}
how do I ...
bool add (Student s); A member function to add a Student. It should verify that the student has not already been added by checking if the id is a repeat; if the student is already in the course or the course is full, return false bool remove (Student s); A member function to remove a Student. It if the student is in the course, it should remove them, shift the remaining students to the left as necessary, lower the number number of enrolled students, and return true. If the student is not enrolled, return false
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started