Course Management
Course Management
Course Management
#include <string>
class Person {
protected:
std::string name;
int age;
public:
Person(const std::string& name, int age) : name(name), age(age) {}
void display() {
std::cout << "Name: " << name << std::endl;
std::cout << "Age: " << age << std::endl;
}
};
public:
Faculty(const std::string& name, int age, const std::string& department)
: Person(name, age), department(department) {}
void display() {
Person::display();
std::cout << "Department: " << department << std::endl;
}
};
public:
Student(const std::string& name, int age, const std::string& major)
: Person(name, age), major(major) {}
void display() {
Person::display();
std::cout << "Major: " << major << std::endl;
}
};
class Course {
protected:
std::string name;
int credits;
public:
Course(const std::string& name, int credits) : name(name), credits(credits) {}
void display() {
std::cout << "Course Name: " << name << std::endl;
std::cout << "Credits: " << credits << std::endl;
}
};
public:
Degree(const std::string& name, int credits, const std::string& level)
: Course(name, credits), level(level) {}
void display() {
Course::display();
std::cout << "Level: " << level << std::endl;
}
};
public:
Bsc(const std::string& name, int credits, const std::string& level, const std::string&
specialization)
: Degree(name, credits, level), specialization(specialization) {}
void display() {
Degree::display();
std::cout << "Specialization: " << specialization << std::endl;
}
};
int main() {
Faculty faculty("John Doe", 40, "Computer Science");
faculty.display();
return 0;