New folder/degree.h
#pragma once
enum DegreeProgram
{
SECURITY, NETWORK, SOFTWARE
};
New folder/main.cpp
#include
#include "Roster.h"
#include "degree.h"
using namespace std;
int main()
{
Roster classRoster;
classRoster.add("A1", "John", "Smith", "John1989@gm ail.com", 20, 30, 35, 40, SECURITY);
classRoster.add("A2", "Suzan", "Erickson", "Erickson_1990@gmailcom", 19, 50, 30, 40, NETWORK);
classRoster.add("A3", "Jack", "Napoli", "The_lawyer99yahoo.com", 19, 20, 40, 33, SOFTWARE);
classRoster.add("A4", "Erin", "Black", "
[email protected]", 22, 50, 58, 40, SECURITY);
classRoster.add("A5", "Max", "Smith", "
[email protected]", 22, 50,50,50, SOFTWARE);
cout << "Displaying all students:" << endl;
classRoster.printAll();
classRoster.printInvalidEmails(); //loop through classRosterArray and for each element:
cout << endl;
classRoster.printAverageDaysInCourse("A1");
classRoster.printAverageDaysInCourse("A2");
classRoster.printAverageDaysInCourse("A3");
classRoster.printAverageDaysInCourse("A4");
classRoster.printAverageDaysInCourse("A5");
cout << "\nShowing students in degree program: SOFTWARE\n" << endl;
classRoster.printByDegreeProgram(SOFTWARE);
cout << "\nRemoving A3" << endl;
classRoster.remove("A3");
cout << "\n" << endl;
classRoster.printAll();
cout << "\nRemoving A3 again\n" << endl;
classRoster.remove("A3");
//expected: the above line should print a message saying such a student with this ID was not found.
}
New folder/Roster.cpp
#include "Roster.h"
Roster::Roster()
{
index = 0;
}
void Roster::add(string studentID, string firstName, string lastName, string emailAddress, int age, int days1, int days2, int days3, DegreeProgram degreeProgram)
{
classRosterArray[index] = new Student (studentID, firstName, lastName, emailAddress, age, days1, days2, days3, degreeProgram);;
index++;
}
void Roster::remove(string studentID)
{
int found = 0;
for (int i = 0; i < index; i++)
{
if (classRosterArray[i]->getStudentID() == studentID)
{
found++;
for (int j = i; j < index - 1;j++)
{
classRosterArray[j] =...