Commit bce03cab authored by Andrew Binder's avatar Andrew Binder

Updating Teacher Class

parent 96e1a154
#include "Teacher.h"
#include <iostream>
Teacher::Teacher(string userNameIn) {
userName = userNameIn;
}
void Teacher::displayMenu() {
}
void Teacher::displayProgress() {
cout << "------STUDENT GRADEBOOK------\n";
cout << "Student\t\tCurrent Level\n";
for (int i = 0; i < roster.size(); i++) {
cout << roster.at(i).getUserName() << "\t\t" << roster.at(i).getLevel() << endl;
}
}
bool Teacher::exportProgress() {
}
bool Teacher::enrollStudent(Student studentIn) {
roster.push_back(studentIn);
}
bool Teacher::adjustProgress(Student studentIn, int level) {
}
void Teacher::endProgram() {
}
// Accessors
const string Teacher::getUserName() {
return userName;
}
const string Teacher::getExitCode() {
return exitCode;
}
// Mutators
bool Teacher::setExitCode(string exitCodeIn) {
exitCode = exitCodeIn;
}
bool Teacher::setUserName(string userNameIn) {
userName = userNameIn;
}
\ No newline at end of file
......@@ -5,6 +5,10 @@ using namespace std;
class Student {
public:
Student(string userNameIn) {
userName = userNameIn;
}
int getLevel() {
return level;
}
......@@ -12,17 +16,20 @@ class Student {
return userName;
}
void setLevel(int levelIn) {
level = levelIn;
}
void setUserName(string userNameIn) {
userName = userNameIn;
}
private:
string userName;
int level = 1;
};
class Teacher {
private:
string userName;
string exitCode;
//vector<Student> roster;
public:
Teacher(string userNameIn); // Default constructor
......@@ -30,8 +37,8 @@ class Teacher {
void displayMenu();
void displayProgress(); // Opens menu, teacher get get all (gradebook style) or a student
bool exportProgress(); // outputProgress() in UML
// bool enrollStudent(Student studentIn);
// bool adjustProgress(Student studentIn, int level);
bool enrollStudent(Student studentIn);
bool adjustProgress(Student studentIn, int level);
void endProgram();
// Accessors
......@@ -41,4 +48,10 @@ class Teacher {
// Mutators
bool setExitCode(string exitCodeIn);
bool setUserName(string userNameIn);
private:
string userName;
string exitCode;
vector<Student> roster;
};
\ No newline at end of file
// ***************************************
// Test Drive compilation instructions:
// g++ -std=c++11 Teacher_Driver.cpp Teacher.cpp -o Teacher_Driver.cpp.o
#include <string>
#include <iostream>
#include "Teacher.h"
using namespace std;
int main() {
string teacherUserName;
cout << "First we will test the constructor: \nInput a username: ";
cin >> teacherUserName;
Teacher testTeacher(teacherUserName);
cout << "The test teachers name is " << testTeacher.getUserName() << ".\n\n";
cout << "Now, we will enroll some students.\nEnter three students names: ";
for (int i = 0; i < 3; i++) {
string studentNameIn;
cin >> studentNameIn;
Student studentIn(studentNameIn);
testTeacher.enrollStudent(studentIn);
}
cout << "\nNow we will test the displayProgress() function.\n";
testTeacher.displayProgress();
return 0;
}
\ No newline at end of file
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