Commit 9d76f3c2 authored by Andrew Binder's avatar Andrew Binder

Added accessor/mutator for a student in the roster vector

parent eda9d7ed
......@@ -233,6 +233,10 @@ const bool Teacher::getMenuActive() {
return teacherMenuActive;
}
const student getStudent(int vectorPosition) {
return roster.at(vectorPosition);
}
// Mutators
void Teacher::setExitCode(string exitCodeIn) {
exitCode = exitCodeIn;
......@@ -240,4 +244,8 @@ void Teacher::setExitCode(string exitCodeIn) {
void Teacher::setUserName(string userNameIn) {
userName = userNameIn;
}
void setStudent(Student studentIn) {
roster.at(studentIn.checkRoster()) = studentIn;
}
\ No newline at end of file
......@@ -28,22 +28,25 @@ class Teacher {
void adjustProgress(string studentUserNameIn, int level); // Changes a students level; includes error checking for student username
int checkRoster(string student); // Returns a student's position on vector if username student exists in vector; Returns -1 if student does not exist
void endProgram(); // saves and ends program gracefully
// Accessors
const string getUserName();
const string getExitCode();
const bool getMenuActive();
const student getStudent(int vectorPosition);
// Mutators
void setExitCode(string exitCodeIn);
void setUserName(string userNameIn);
void setStudent(Student studentIn); // I think it's safe to say that studentIn will be a student in the vector
vector<Student> roster;
// vector<Student> roster;
private:
bool teacherMenuActive = 1;
string userName;
string exitCode = "Quit";
//vector<Student> roster;
vector<Student> roster;
// Strings for file I/O
// If a file location needs to be changed, this is the place to do it!
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment