// Student (Derived from Person)
class Student : public Person {
private:
char studentID[100];
char enrollmentDate[100];
char completedCourses[5][100];
int completedCount;
char peerGroup[5][100];
int peerCount;
public:
Student(const char* n, const char* i, const char* e, const char* sid, const char* ed)
: Person(n, i, e), completedCount(0) {
copyString(studentID, sid);
copyString(enrollmentDate, ed);
}
void enrollInCourse(const char* courseName) {
if (completedCount < 5) {
copyString(completedCourses[completedCount], courseName);
completedCount++;
}
else {
cout << "Cannot enroll in more than 5 courses." << endl;
}
}
void displayInfo() const override {
cout << "Name: " << name << ", ID: " << id << ", Email: " << email << ", Student ID: " << studentID << endl;
cout << "Enrollment Date: " << enrollmentDate << endl;
cout << "Completed Courses: ";
for (int i = 0; i < completedCount; i++) {
cout << completedCourses[i] << (i == completedCount - 1 ? "" : ", ");
}
cout << endl;
}
const char* getRole() const override {
return "Student";
}
void sendNotification(const char* message) const override {
cout << "Notification to Student: " << message << endl;
}
void submitAssignments() {
// Define an array of courses available for submission
const char* courses[] = {
"Computer Basics",
"Python Complete Course",
"Web Development",
"Data Structures and Algorithms",
"Machine Learning",
"Artificial Intelligence",
"Database Management",
"Networking Fundamentals",
"Operating Systems",
"Software Engineering"
};
const int numCourses = sizeof(courses) / sizeof(courses[0]);
// Display courses available for the student to submit assignments for
cout << "===========================================" << endl;
cout << " Submit Assignments " << endl;
cout << "===========================================" << endl;
cout << "Select a course to submit an assignment for:" << endl;
for (int i = 0; i < numCourses; i++) {
cout << i + 1 << ". " << courses[i] << endl;
}
int courseChoice;
cout << "Enter your choice (1-" << numCourses << "): ";
cin >> courseChoice;
// Validate the course selection
if (courseChoice < 1 || courseChoice > numCourses) {
cout << "Invalid choice. Please try again." << endl;
return; // Exit if the selection is invalid
}
// Ask the student to enter assignment details
cin.ignore(); // To clear any remaining newline characters from the input buffer
char assignmentName[100];
cout << "Enter the assignment name: ";
cin.getline(assignmentName, sizeof(assignmentName));
char submissionContent[500];
cout << "Enter the assignment content: ";
cin.getline(submissionContent, sizeof(submissionContent));
// Here you would typically save the submission to a database or file
// For simplicity, we'll just print the submission details
cout << "===========================================" << endl;
cout << " Assignment Submitted Successfully! " << endl;
cout << "Course: " << courses[courseChoice - 1] << endl;
cout << "Assignment: " << assignmentName << endl;
cout << "Content: " << submissionContent << endl;
cout << "===========================================" << endl;
}
void checkProgress() {
cout << "===========================================" << endl;
cout << " Checking Progress " << endl;
cout << "===========================================" << endl;
cout<<"Enter number of Completed Courses"<<endl;
Assistant
Creating a textual class diagram requires converting the relationships, attributes, and operations in your codebase into a structured representation. Here's the corresponding class diagram in text format for your code:
cin>>completedCount;
if (completedCount == 0) {
cout << "You have not enrolled in any courses yet." << endl;
return;
}
int progress[5]; // Array to store progress for each course
// Ask the user to input progress for each completed course
for (int i = 0; i < completedCount; i++) {
cout << "Enter progress for the course \"" << completedCourses[i] << "\" (0-100): ";
cin >> progress[i];
// Validate the input to ensure it's within the range 0-100
while (progress[i] < 0 || progress[i] > 100) {
cout << "Invalid input. Progress must be between 0 and 100. Try again: ";
cin >> progress[i];
}
}
// Display the progress for each course
cout << "===========================================" << endl;
for (int i = 0; i < completedCount; i++) {
if(progress[i]==100){
cout << "Course: " << completedCourses[i]
<< "completed"<< endl;}
else{
cout << "Course: " << completedCourses[i]
<< "Underway"<< endl;
}
cout << "===========================================" << endl;}
}
void viewCertifications() {
cout << "===========================================" << endl;
cout << " View Certifications " << endl;
cout << "===========================================" << endl;
cout<<"Enter the number of courses completed"<<endl;
cin>>completedCount;
if (completedCount == 0) {
cout << "No courses completed yet. Complete courses to earn certifications." << endl;
return;
}
// Input progress for each course
int progress[5];
for (int i = 0; i < completedCount; i++) {
cout << "Enter progress for the course \"" << completedCourses[i] << "\" (0-100): ";
cin >> progress[i];
// Validate progress input
while (progress[i] < 0 || progress[i] > 100) {
cout << "Invalid input. Progress must be between 0 and 100. Try again: ";
cin >> progress[i];
}
}
// Display certifications for completed courses
bool hasCertifications = false;
cout << "===========================================" << endl;
cout << " Certifications Earned " << endl;
cout << "===========================================" << endl;
int count;
for (int i = 0; i < completedCount; i++) {
if (progress[i] == 100) {
cout << "- Certification earned for " << count + 1<< endl;
hasCertifications = true;
}
}
if (!hasCertifications) {
cout << "No certifications earned yet. Complete courses to earn certifications." << endl;
}
cout << "===========================================" << endl;
// Initialize the peer group with predefined peers
peerCount = 0;
for (int i = 0; i < 5; i++) {
copyString(peerGroup[i], predefinedPeers[i]);
peerCount++;
}
cout << "Peer group has been populated with peers:" << endl;
for (int i = 0; i < peerCount; i++) {
cout << i + 1 << ". " << peerGroup[i] << endl;
}
}
void displayPeers() const {
cout << "Peer Group: ";
for (int i = 0; i < peerCount; i++) {
cout << peerGroup[i] << (i == peerCount - 1 ? "" : ", ");
}
cout << endl;
}
};
// Instructor (Derived from Person)
class Instructor : public Person {
private:
char employeeID[100];
char department[100];
char assignedCourses[5][100];
int courseCount;
public:
Instructor(const char* n, const char* i, const char* e, const char* empID, const char* dept)
: Person(n, i, e), courseCount(0) {
copyString(employeeID, empID);
copyString(department, dept);
copyString(assignedCourses[0], "Computer Basics");
copyString(assignedCourses[1], "Python Complete Course");
copyString(assignedCourses[2], "Web Development");
copyString(assignedCourses[3], "Data Structures and Algorithms");
copyString(assignedCourses[4], "Machine Learning");
}
void assignCourse(const char* courseName) {
if (courseCount < 5) {
copyString(assignedCourses[courseCount], courseName);
courseCount++;
}
else {
cout << "Cannot assign more than 5 courses." << endl;
}
}
void displayInfo() const override {
cout << "Name: " << name << ", ID: " << id << ", Email: " << email << ", Employee ID: " << employeeID << endl;
cout << "Department: " << department << endl;
cout << "Assigned Courses: ";
for (int i = 0; i < courseCount; i++) {
cout << assignedCourses[i] << (i == courseCount - 1 ? "" : ", ");
}
cout << endl;
}
const char* getRole() const override {
return "Instructor";
}
void sendNotification(const char* message) const override {
cout << "Notification to Instructor: " << message << endl;
}
void createAssignments() {
cout << "===========================================" << endl;
cout << " Create Assignment " << endl;
cout << "===========================================" << endl;
cout << "Enter total courses" << endl;
cin >> courseCount;
// Check if there are any courses assigned to the instructor
if (courseCount == 0) {
cout << "No courses assigned to this instructor." << endl;
return;
}
// Display the courses assigned to the instructor
cout << "Select a course to create an assignment for:" << endl;
for (int i = 0; i < courseCount; i++) {
cout << i + 1 << ". " << assignedCourses[i] << endl;
}
// Ask for the course name
char courseName[100];
cout << "Enter the exact course name: ";
cin.ignore(); // To clear any remaining newline characters in the input buffer
cin.getline(courseName, sizeof(courseName));
// Check if the entered course name exists in the list of assigned courses
bool courseFound = false;
for (int i = 0; i < courseCount; i++) {
if (strcmp(courseName, assignedCourses[i]) == 0) {
courseFound = true;
break;
}
}
if (!courseFound) {
cout << "Invalid course name. Please try again." << endl;
return; // Exit the function if the course is not found
}
// Get the assignment details
char assignmentType[100];
char assignmentDescription[500];
cout << "Enter the type of assignment (e.g., Quiz, Homework, Project): ";
cin.getline(assignmentType, sizeof(assignmentType));
cout << "Enter a brief description of the assignment: ";
cin.getline(assignmentDescription, sizeof(assignmentDescription));
// Store or display the assignment details
cout << "Assignment Created!" << endl;
cout << "Course: " << courseName << endl;
cout << "Assignment Type: " << assignmentType << endl;
cout << "Assignment Description: " << assignmentDescription << endl;
}
void gradeSubmissions() {
cout << "===========================================" << endl;
cout << " Grade Submissions " << endl;
cout << "===========================================" << endl;
// Define an array of course names
const char* courses[] = {
"Computer Basics",
"Python Complete Course",
"Web Development",
"Software E ngineering",
"Data Structures and Algorithms",
"Machine Learning",
"Artificial Intelligence",
"Database Management",
"Networking Fundamentals",
"Operating Systems",
"Software Engineering"
};
const int numCourses = sizeof(courses) / sizeof(courses[0]);
// Ask for the student name
char studentName[100];
cout << "Enter the student's name: ";
cin.ignore(); // Clear the input buffer
cin.getline(studentName, sizeof(studentName));
// Ask for the course name
char courseName[100];
cout << "Enter the course name: ";
cin.getline(courseName, sizeof(courseName));
// Validate the course name
bool courseFound = false;
for (int i = 0; i < numCourses; i++) {
if (strcmp(courses[i], courseName) == 0) {
courseFound = true;
break;
}
}
if (!courseFound) {
cout << "Invalid course name. Please try again." << endl;
return; // Exit if the course is not found
}
// Ask for the grade
double grade;
cout << "Enter the grade (e.g., 95.5): ";
cin >> grade;
// Display confirmation
cout << "Grade submitted successfully!" << endl;
cout << "Student: " << studentName << endl;
cout << "Course: " << courseName << endl;
cout << "Grade: " << grade << endl;
}
void monitorStudentProgress() {
cout << "===========================================" << endl;
cout << " Monitor Student Progress " << endl;
cout << "===========================================" << endl;
cin >> courseCount;
// Check if there are any courses assigned to the instructor
if (courseCount == 0) {
cout << "No courses assigned to this instructor." << endl;
return;
}
// Display the list of assigned courses
cout << "Assigned Courses:" << endl;
for (int i = 0; i < courseCount; i++) {
cout << i + 1 << ". " << assignedCourses[i] << endl;
}
// Ask the instructor to select a course
char courseName[100];
cout << "Enter the exact course name to monitor progress: ";
cin.ignore(); // Clear the input buffer
cin.getline(courseName, sizeof(courseName));
// Check if the entered course exists in the list of assigned courses
bool courseFound = false;
for (int i = 0; i < courseCount; i++) {
if (strcmp(courseName, assignedCourses[i]) == 0) {
courseFound = true;
break;
}
}
if (!courseFound) {
cout << "Invalid course name. Please try again." << endl;
return; // Exit the function if the course is not found
}
// Ask for the number of students
int numStudents;
cout << "Enter the number of students in the course: ";
cin >> numStudents;
cin.ignore(); // Clear the input buffer
if (numStudents <= 0) {
cout << "Invalid number of students. Exiting." << endl;
return;
}
// Dynamically allocate arrays for student names and progress
char studentNames[numStudents][100];
int progress[numStudents];
// Input student details
for (int i = 0; i < numStudents; i++) {
cout << "Enter the name of student " << i + 1 << ": ";
cin.getline(studentNames[i], sizeof(studentNames[i]));
cout << "Enter the progress percentage of " << studentNames[i] << " (0-100): ";
cin >> progress[i];
cin.ignore(); // Clear the input buffer
if (progress[i] < 0 || progress[i] > 100) {
cout << "Invalid progress percentage. Setting progress to 0." << endl;
progress[i] = 0;
}
}
// Display the progress report
cout << "Progress Report for Course: " << courseName << endl;
cout << "-------------------------------------------" << endl;
for (int i = 0; i < numStudents; i++) {
cout << "Student: " << studentNames[i]
<< ", Progress: " << progress[i] << "%" << endl;
}
cout << "-------------------------------------------" << endl;
// Additional functionality: Notify students with low progress
cout << "Students with progress below 50%:" << endl;
bool lowProgressFound = false;
for (int i = 0; i < numStudents; i++) {
if (progress[i] < 50) {
cout << "- " << studentNames[i] << endl;
lowProgressFound = true;
}
}
if (!lowProgressFound) {
cout << "All students are progressing well." << endl;
}
}
void issueCertifications() {
cout << "Issuing certificates..." << endl;
}
};
class Certificate {
private:
int certificateID;
string issueDate;
string courseTitle;
string recipient;
// Menu for Certificate Management
void certificateMenu() {
// Sample Certificate Data
Certificate cert1(1, "2022-08-13", "Advanced C++ Programming", "Ahmed");
Certificate cert2(2, "2017-11-04", "Data Structures and Algorithms", "Nabeel");
Certificate cert3(2, "2015-03-12", "Web Development", "Maleeha");
Certificate cert4(2, "2014-12-23", "Database Management", "Aqbar");
Certificate cert5(2, "2019-05-18", "Artificial Intelligence", "Rehan");
while (true) {
cout << "===========================================" << endl;
cout << " Certificate Menu " << endl;
cout << "===========================================" << endl;
cout << "1. View Certificate for Ahmed" << endl;
cout << "2. View Certificate for Nabeel" << endl;
cout << "3. View Certificate for Maleeha" << endl;
cout << "4. View Certificate for Aqbar" << endl;
cout << "5. View Certificate for Rehan" << endl;
cout << "6. Exit to Main Menu" << endl;
int choice;
cout << "Enter your choice: ";
cin >> choice;
switch (choice) {
case 1:
cert1.displayCertificate();
break;
case 2:
cert2.displayCertificate();
break;
case 3:
cert3.displayCertificate();
break;
case 4:
cert4.displayCertificate();
break;
case 5:
cert5.displayCertificate();
break;
case 6:
cout << "Exiting to Main Menu..." << endl;
return;
default:
cout << "Invalid choice. Try again." << endl;
break;
}
}
}
class Assignment {
private:
int assignmentID; // Unique identifier for the assignment
char description[500]; // Brief description of the assignment
double maxScore; // The maximum score for the assignment
char dueDate[100]; // The due date for the assignment
class Module {
private:
char moduleTitle[100];
int moduleID;
char contentSections[5][100]; // Array to hold up to 5 content sections
Course& associatedCourse;
// Method to send notification to a student
void sendToStudent(const string& studentName) const {
cout << "===========================================" << endl;
cout << " Notification Sent to Student: " << studentName << endl;
cout << "-------------------------------------------" << endl;
cout << "Notification ID: " << notificationID << endl;
cout << "Message: " << message << endl;
cout << "Date Sent: " << dateSent << endl;
cout << "===========================================\n" << endl;
}
// Method to send notification to an instructor
void sendToInstructor(const string& instructorName) const {
cout << "===========================================" << endl;
cout << " Notification Sent to Instructor: " << instructorName << endl;
cout << "-------------------------------------------" << endl;
cout << "Notification ID: " << notificationID << endl;
cout << "Message: " << message << endl;
cout << "Date Sent: " << dateSent << endl;
cout << "===========================================\n" << endl;
}
// Method to broadcast notification to all students and instructors
void broadcast(const string students[], int studentCount, const string instructors[], int instructorCount) const {
cout << "\n===========================================" << endl;
cout << " Broadcasting Notification " << endl;
cout << "===========================================" << endl;
for (int i = 0; i < studentCount; i++) {
sendToStudent(students[i]);
}
for (int i = 0; i < instructorCount; i++) {
sendToInstructor(instructors[i]);
}
cout << "Notification broadcast complete.\n" << endl;
}
};
// Menu for Notifications
void notificationMenu() {
// Sample Notification Data
Notification notif1(201, "Submit assignment on due date.", "2024-12-08");
Notification notif2(202, "Classes are rescheduled.", "2025-02-24");
// Sample Students and Instructors (fixed-size arrays)
const int studentCount = 3;
const int instructorCount = 2;
string students[studentCount] = { "Ahmed", "Bashir", "Raheem" };
string instructors[instructorCount] = { "Dr. Waqas", "Prof. Hajra" };
while (true) {
cout << "===========================================" << endl;
cout << " Notification Menu " << endl;
cout << "===========================================" << endl;
cout << "1. Send Notification to a Student" << endl;
cout << "2. Send Notification to an Instructor" << endl;
cout << "3. Broadcast Notification" << endl;
cout << "4. Exit to Main Menu" << endl;
int choice;
cout << "Enter your choice: ";
cin >> choice;
switch (choice) {
case 1: {
cout << "Enter the student name: ";
string studentName;
cin.ignore();
getline(cin, studentName);
notif1.sendToStudent(studentName);
break;
}
case 2: {
cout << "Enter the instructor name: ";
string instructorName;
cin.ignore();
getline(cin, instructorName);
notif2.sendToInstructor(instructorName);
break;
}
case 3:
notif1.broadcast(students, studentCount, instructors, instructorCount);
break;
case 4:
cout << "Exiting to Main Menu..." << endl;
return;
default:
cout << "Invalid choice. Try again." << endl;
break;
}
}
}
class Assessment {
private:
int assessmentID;
string assessmentType;
double totalMarks;
double score; // Student's score for the assessment
// Method to take assessment (student enters their score)
void takeAssessment() {
cout << "Enter your score for the " << assessmentType << " (out of " << totalMarks << "): ";
cin >> score;
if (score > totalMarks) {
cout << "Score cannot exceed total marks!" << endl;
score = totalMarks; // Automatically set to max marks if the user exceeds it
}
cout << "Assessment completed! Your score: " << score << endl;
}
// Method to view the score of the assessment
void viewScore() const {
cout << "Your score for the " << assessmentType << " (Assessment ID: " << assessmentID << ") is: " << score << " out of " << totalMarks << endl;
}
// Method to display assessment information
void displayAssessmentInfo() const {
cout << "Assessment ID: " << assessmentID << endl;
cout << "Assessment Type: " << assessmentType << endl;
cout << "Total Marks: " << totalMarks << endl;
}
// Getters for assessment attributes
int getAssessmentID() const { return assessmentID; }
string getAssessmentType() const { return assessmentType; }
double getTotalMarks() const { return totalMarks; }
double getScore() const { return score; }
};
// Menu for managing assessments
void assessmentMenu() {
// Sample assessments
Assessment assessment1(1, "Final Exam", 100);
Assessment assessment2(2, "Midterm Quiz", 50);
while (true) {
cout << "===========================================" << endl;
cout << " Assessment Menu " << endl;
cout << "===========================================" << endl;
cout << "1. Take Assessment" << endl;
cout << "2. View Assessment Score" << endl;
cout << "3. View All Assessments" << endl;
cout << "4. Back to Home" << endl;
int choice;
cout << "Enter your choice: ";
cin >> choice;
switch (choice) {
case 1:
{
int id;
cout << "Enter Assessment ID to take the assessment: ";
cin >> id;
if (id == assessment1.getAssessmentID()) {
assessment1.takeAssessment();
}
else if (id == assessment2.getAssessmentID()) {
assessment2.takeAssessment();
}
else {
cout << "Assessment not found." << endl;
}
}
break;
case 2:
{
int id;
cout << "Enter Assessment ID to view the score: ";
cin >> id;
if (id == assessment1.getAssessmentID()) {
assessment1.viewScore();
}
else if (id == assessment2.getAssessmentID()) {
assessment2.viewScore();
}
else {
cout << "Assessment not found." << endl;
}
}
break;
case 3:
// View all assessment information
cout << "\nAll Assessments:" << endl;
assessment1.displayAssessmentInfo();
assessment2.displayAssessmentInfo();
break;
case 4:
cout << "Returning to Home Page..." << endl;
return; // Go back to home or previous menu
default:
cout << "Invalid choice. Try again." << endl;
break;
}
}