Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
C
cptr142_group_project
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jared Sexton
cptr142_group_project
Commits
4f63ceb4
Commit
4f63ceb4
authored
Mar 07, 2018
by
Andrew Binder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
All files working properly
parent
4d18081b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
65 deletions
+86
-65
Teacher.cpp
Teacher.cpp
+67
-4
Teacher.h
Teacher.h
+11
-31
Teacher_Driver.cpp
Teacher_Driver.cpp
+7
-30
classRoster.txt
classRoster.txt
+1
-0
No files found.
Teacher.cpp
View file @
4f63ceb4
...
@@ -14,13 +14,70 @@ Teacher::Teacher(string userNameIn) {
...
@@ -14,13 +14,70 @@ Teacher::Teacher(string userNameIn) {
}
}
void
Teacher
::
displayMenu
()
{
void
Teacher
::
displayMenu
()
{
cout
<<
"------Teacher Menu------"
<<
endl
;
teacherMenuActive
=
true
;
int
menu
,
levelIn
;
string
stringIn
;
cout
<<
endl
<<
"Teacher Menu"
<<
endl
<<
endl
;
cout
<<
"1. Display Class Progress"
<<
endl
;
cout
<<
"1. Display Class Progress"
<<
endl
;
cout
<<
"2. Export Class Progress"
<<
endl
;
cout
<<
"2. Export Class Progress"
<<
endl
;
cout
<<
"3. Enroll Students"
<<
endl
;
cout
<<
"3. Enroll Students"
<<
endl
;
cout
<<
"4. Adjust Student Progress"
<<
endl
;
cout
<<
"4. Adjust Student Progress"
<<
endl
;
cout
<<
"5. Change Username"
<<
endl
;
cout
<<
"5. Change Username"
<<
endl
;
cout
<<
"6. Change Exit Code"
<<
endl
;
cout
<<
"6. Change Exit Code"
<<
endl
;
cout
<<
"7. Log Out"
<<
endl
;
cout
<<
endl
<<
"Enter Selection: "
;
cin
>>
menu
;
if
(
cin
)
{
switch
(
menu
)
{
case
1
:
displayProgress
();
break
;
case
2
:
exportProgress
();
cout
<<
"Gradebook exported succesfully."
<<
endl
;
break
;
case
3
:
{
cout
<<
"Please enter a username (no spaces): "
;
cin
>>
stringIn
;
Student
studentIn
(
stringIn
);
enrollStudent
(
studentIn
);
break
;
}
case
4
:
cout
<<
"Please enter the student's username followed by a level: "
;
cin
>>
stringIn
>>
levelIn
;
adjustProgress
(
stringIn
,
levelIn
);
break
;
case
5
:
cout
<<
"Your username is currently "
<<
userName
<<
"."
<<
endl
;
cout
<<
"Please input a new username: "
;
cin
>>
stringIn
;
setUserName
(
stringIn
);
break
;
case
6
:
cout
<<
"The exit code is currently "
<<
exitCode
<<
"."
<<
endl
;
cout
<<
"Please input a new exit code: "
;
cin
>>
stringIn
;
setExitCode
(
stringIn
);
break
;
case
7
:
saveProgress
();
cout
<<
"Goodbye."
<<
endl
;
teacherMenuActive
=
0
;
// exit(0);
break
;
default:
cout
<<
"Invalid choice.
\n
"
;
break
;
}
}
else
{
cin
.
clear
();
cin
.
ignore
(
100
,
'\n'
);
cout
<<
"Invalid choice.
\n
"
;
}
}
}
void
Teacher
::
displayProgress
()
{
void
Teacher
::
displayProgress
()
{
...
@@ -35,7 +92,7 @@ void Teacher::displayProgress() {
...
@@ -35,7 +92,7 @@ void Teacher::displayProgress() {
}
}
void
Teacher
::
exportProgress
()
{
void
Teacher
::
exportProgress
()
{
fout
.
open
(
"classProgress.txt"
);
fout
.
open
(
progressFileName
);
fout
<<
userName
<<
"'s Class Progress Report"
<<
endl
<<
endl
;
fout
<<
userName
<<
"'s Class Progress Report"
<<
endl
<<
endl
;
fout
.
width
(
10
);
fout
.
width
(
10
);
...
@@ -50,19 +107,21 @@ void Teacher::exportProgress() {
...
@@ -50,19 +107,21 @@ void Teacher::exportProgress() {
}
}
void
Teacher
::
saveProgress
()
{
void
Teacher
::
saveProgress
()
{
fout
.
open
(
"classRoster.txt"
);
fout
.
open
(
rosterFileName
);
fout
<<
userName
<<
" "
<<
exitCode
<<
endl
;
fout
<<
userName
<<
" "
<<
exitCode
<<
endl
;
for
(
int
i
=
0
;
i
<
roster
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
roster
.
size
();
i
++
)
{
fout
<<
roster
.
at
(
i
).
getUserName
()
<<
" "
<<
roster
.
at
(
i
).
getLevel
()
<<
endl
;
fout
<<
roster
.
at
(
i
).
getUserName
()
<<
" "
<<
roster
.
at
(
i
).
getLevel
()
<<
endl
;
}
}
fout
<<
"END_OF_FILE"
;
fout
<<
"END_OF_FILE"
;
fout
.
close
();
fout
.
close
();
}
}
void
Teacher
::
importProgress
()
{
void
Teacher
::
importProgress
()
{
string
parseName
;
string
parseName
;
int
parseLevel
;
int
parseLevel
;
fin
.
open
(
"classRoster.txt"
);
fin
.
open
(
rosterFileName
);
fin
>>
userName
>>
exitCode
;
fin
>>
userName
>>
exitCode
;
...
@@ -131,6 +190,10 @@ const string Teacher::getExitCode() {
...
@@ -131,6 +190,10 @@ const string Teacher::getExitCode() {
return
exitCode
;
return
exitCode
;
}
}
const
bool
Teacher
::
getMenuActive
()
{
return
teacherMenuActive
;
}
// Mutators
// Mutators
void
Teacher
::
setExitCode
(
string
exitCodeIn
)
{
void
Teacher
::
setExitCode
(
string
exitCodeIn
)
{
exitCode
=
exitCodeIn
;
exitCode
=
exitCodeIn
;
...
...
Teacher.h
View file @
4f63ceb4
#include "Student.h"
#include <vector>
#include <vector>
#include <string>
#include <string>
using
namespace
std
;
using
namespace
std
;
class
Student
{
#ifndef TEACHER_H
public:
#define TEACHER_H
Student
(
string
userNameIn
)
{
userName
=
userNameIn
;
}
Student
(
string
userNameIn
,
int
levelIn
)
{
userName
=
userNameIn
;
level
=
levelIn
;
}
int
getLevel
()
{
return
level
;
}
string
getUserName
()
{
return
userName
;
}
void
setLevel
(
int
levelIn
)
{
level
=
levelIn
;
}
void
setUserName
(
string
userNameIn
)
{
userName
=
userNameIn
;
}
private:
string
userName
;
int
level
=
1
;
};
class
Teacher
{
class
Teacher
{
public:
public:
...
@@ -52,14 +25,21 @@ class Teacher {
...
@@ -52,14 +25,21 @@ class Teacher {
// Accessors
// Accessors
const
string
getUserName
();
const
string
getUserName
();
const
string
getExitCode
();
const
string
getExitCode
();
const
bool
getMenuActive
();
// Mutators
// Mutators
void
setExitCode
(
string
exitCodeIn
);
void
setExitCode
(
string
exitCodeIn
);
void
setUserName
(
string
userNameIn
);
void
setUserName
(
string
userNameIn
);
private:
private:
bool
teacherMenuActive
=
1
;
string
userName
;
string
userName
;
string
exitCode
=
"Quit"
;
string
exitCode
=
"Quit"
;
vector
<
Student
>
roster
;
vector
<
Student
>
roster
;
};
string
rosterFileName
=
"classRoster.txt"
;
// Used for use by program as import/export
\ No newline at end of file
string
progressFileName
=
"classProgress.txt"
;
// Used for teacher
};
#endif //TEACHER_H
\ No newline at end of file
Teacher_Driver.cpp
View file @
4f63ceb4
...
@@ -9,44 +9,21 @@
...
@@ -9,44 +9,21 @@
using
namespace
std
;
using
namespace
std
;
int
main
()
{
int
main
()
{
string
teacherUserName
;
string
teacherUserName
;
cout
<<
"First we will test the constructor:
\n
Input a username: "
;
// cin >> teacherUserName;
Teacher
testTeacher
;
Teacher
testTeacher
;
testTeacher
.
importProgress
();
testTeacher
.
importProgress
();
cout
<<
"The test teachers name is "
<<
testTeacher
.
getUserName
()
<<
".
\n\n
"
;
cout
<<
"The test teachers name is "
<<
testTeacher
.
getUserName
()
<<
".
\n
"
;
// cout << "Display Menu:\n";
//testTeacher.displayMenu();
// 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);
// }
// //Student studentIn("Andrew");
// //testTeacher.enrollStudent(studentIn);
// cout << "\nNow we will test the displayProgress() function.\n";
// testTeacher.displayProgress();
// testTeacher.adjustProgress("Andrew",5);
testTeacher
.
displayProgress
();
do
{
testTeacher
.
exportProgress
();
testTeacher
.
displayMenu
();
// testTeacher.saveProgress();
if
(
!
testTeacher
.
getMenuActive
())
{
break
;
}
}
while
(
true
);
return
0
;
return
0
;
}
}
\ No newline at end of file
classRoster.txt
View file @
4f63ceb4
...
@@ -11,4 +11,5 @@ inghro 2
...
@@ -11,4 +11,5 @@ inghro 2
umalno 1
umalno 1
grifno 1
grifno 1
levina 4
levina 4
Andrew 500
END_OF_FILE
END_OF_FILE
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment