Program needs to be in C++ The program will have a person, student, and faculty class. Use an STL for a list rather than using the "list" class. Populate an STL structure with a series of objects (at least 5 combined). Create a list of POINTERS to objects, so you can use polymorphism. The beginning of the list should be all faculty (add to the head), and the end of the list (add at the tail) should be students/interns. It is not necessary to add the base class objects. Utilize the STL functions to apply: add student/intern/faculty, remove a specific entry from a user input of a name, search for name, print all, and delete all. The menu items will be in main and call the STL functions. Please use the code below and make the appropriate edits #include #include using namespace std; struct Date {     int month, year; }; class Person { protected:     string name, department; public:     Person() {         name = "";         department = "";     }     Person(string n, string d) {         name = n, department = d;     }     void print() {         cout << "Name: " << name << endl;         cout << "Department: " << department << endl;     }     string getName() {         return name;     }     string getDepartment() {         return department;     }     ~Person() {         cout << "\nDone";     } }; class Student : public Person { protected:     Date graduationDate; public:     Student() {         graduationDate.month = 0;         graduationDate.year = 0;     }     Student(string n, string d, Date date) {         name = n, department = d;         graduationDate = date;     }     void setGraduationDate(Date d) {         graduationDate = d;     }     Date getGraduationDate() {         return graduationDate;     }     int timeToGraduation(Date today) {         if (today.month > graduationDate.month) {             return ((graduationDate.year - today.year - 1) * 12 +                 (12 - today.month) + graduationDate.month);         }         else {             return ((graduationDate.year - today.year) * 12 +                 abs(today.month - graduationDate.month));         }     }     void print() {         cout << "Name: " << name << endl;         cout << "Department: " << department << endl;         cout << "Graduation Date: " << graduationDate.month << "/" << graduationDate.year << endl;     } }; class Faculty : public Person { protected:     Date startDate;     string title; public:     Faculty(string n, string d, string t, Date date) {         name = n, department = d, title = t;         startDate = date;     }     void setTitle(string t) {         title = t;     }     void setStartDate(Date d) {         startDate = d;     }     string getTitle() {         return title;     }     Date getStartDate() {         return startDate;     }     void print() {         cout << "Name: " << name << endl;         cout << "Department: " << department << endl;         cout << "Title: " << title << endl;         cout << "Start Date: " << startDate.month << "/" << startDate.year << endl;     } }; class Intern : public Student { protected:     string company;     double salary; public:     Intern(string n, string d, Date date, string c, double s) {         name = n, department = d;         graduationDate = date;         company = c;         salary = s;     }     void setSalary(double s) {         salary = s;     }     void setCompany(string c) {         company = c;     }     string getCompany() {         return company;     }     double getSalary() {         return salary;     }     void print() {         cout << "Name: " << name << endl;         cout << "Department: " << department << endl;         cout << "Company: " << company << endl;         cout << "Salary: " << salary << endl;         cout << "Graduation Date: " << graduationDate.month << "/" << graduationDate.year << endl;     } }; int main() {     Date today, graduation;     today.month = 3;     today.year = 2021;     graduation.month = 10;     graduation.year = 2027;     Student John("John Smith", "Computer Science", graduation);     Faculty Chris("Chris Smith", "Computer Science", "Associate Professor", today);     Intern Bob("Bob Smith", "Computer Science", graduation, "Apple", 60000.0);     Student* studentArray = new Student[10];     John.print();     cout << "Time for John to graduate: " << John.timeToGraduation(today) << " months\n";     cout << endl;     Chris.print();     cout << endl;     Bob.print();     cout << "Time for Bob to graduate: " << Bob.timeToGraduation(today) << " months\n";     return 0; }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

 

Program needs to be in C++

The program will have a person, student, and faculty class. Use an STL for a list rather than using the "list" class. Populate an STL structure with a series of objects (at least 5 combined). Create a list of POINTERS to objects, so you can use polymorphism. The beginning of the list should be all faculty (add to the head), and the end of the list (add at the tail) should be students/interns. It is not necessary to add the base class objects. Utilize the STL functions to apply: add student/intern/faculty, remove a specific entry from a user input of a name, search for name, print all, and delete all. The menu items will be in main and call the STL functions.

Please use the code below and make the appropriate edits

#include <iostream>
#include <bits/stdc++.h>
using namespace std;

struct Date {
    int month, year;
};

class Person {
protected:
    string name, department;
public:
    Person() {
        name = "";
        department = "";
    }
    Person(string n, string d) {
        name = n, department = d;
    }
    void print() {
        cout << "Name: " << name << endl;
        cout << "Department: " << department << endl;
    }
    string getName() {
        return name;
    }
    string getDepartment() {
        return department;
    }
    ~Person() {
        cout << "\nDone";
    }
};

class Student : public Person {
protected:
    Date graduationDate;
public:
    Student() {
        graduationDate.month = 0;
        graduationDate.year = 0;
    }
    Student(string n, string d, Date date) {
        name = n, department = d;
        graduationDate = date;
    }
    void setGraduationDate(Date d) {
        graduationDate = d;
    }
    Date getGraduationDate() {
        return graduationDate;
    }
    int timeToGraduation(Date today) {
        if (today.month > graduationDate.month) {
            return ((graduationDate.year - today.year - 1) * 12 +
                (12 - today.month) + graduationDate.month);
        }
        else {
            return ((graduationDate.year - today.year) * 12 +
                abs(today.month - graduationDate.month));
        }
    }
    void print() {
        cout << "Name: " << name << endl;
        cout << "Department: " << department << endl;
        cout << "Graduation Date: " << graduationDate.month << "/" << graduationDate.year << endl;
    }
};

class Faculty : public Person {
protected:
    Date startDate;
    string title;
public:
    Faculty(string n, string d, string t, Date date) {
        name = n, department = d, title = t;
        startDate = date;
    }
    void setTitle(string t) {
        title = t;
    }
    void setStartDate(Date d) {
        startDate = d;
    }
    string getTitle() {
        return title;
    }
    Date getStartDate() {
        return startDate;
    }
    void print() {
        cout << "Name: " << name << endl;
        cout << "Department: " << department << endl;
        cout << "Title: " << title << endl;
        cout << "Start Date: " << startDate.month << "/" << startDate.year << endl;
    }
};

class Intern : public Student {
protected:
    string company;
    double salary;
public:
    Intern(string n, string d, Date date, string c, double s) {
        name = n, department = d;
        graduationDate = date;
        company = c;
        salary = s;
    }
    void setSalary(double s) {
        salary = s;
    }
    void setCompany(string c) {
        company = c;
    }
    string getCompany() {
        return company;
    }
    double getSalary() {
        return salary;
    }
    void print() {
        cout << "Name: " << name << endl;
        cout << "Department: " << department << endl;
        cout << "Company: " << company << endl;
        cout << "Salary: " << salary << endl;
        cout << "Graduation Date: " << graduationDate.month << "/" << graduationDate.year << endl;
    }
};

int main() {
    Date today, graduation;
    today.month = 3;
    today.year = 2021;
    graduation.month = 10;
    graduation.year = 2027;

    Student John("John Smith", "Computer Science", graduation);
    Faculty Chris("Chris Smith", "Computer Science", "Associate Professor", today);
    Intern Bob("Bob Smith", "Computer Science", graduation, "Apple", 60000.0);

    Student* studentArray = new Student[10];

    John.print();
    cout << "Time for John to graduate: " << John.timeToGraduation(today) << " months\n";
    cout << endl;
    Chris.print();
    cout << endl;
    Bob.print();
    cout << "Time for Bob to graduate: " << Bob.timeToGraduation(today) << " months\n";
    return 0;
}

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY