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
6492841b
Commit
6492841b
authored
Mar 06, 2018
by
Andrew Binder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Student.h, updating Teacher class for more file I/O
parent
adbf6362
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
96 additions
and
11 deletions
+96
-11
Student.h
Student.h
+45
-0
Teacher.cpp
Teacher.cpp
+21
-5
Teacher_Driver.cpp
Teacher_Driver.cpp
+2
-2
classProgress.txt
classProgress.txt
+16
-0
classRoster.txt
classRoster.txt
+12
-4
No files found.
Student.h
0 → 100644
View file @
6492841b
// ***********************************************************************
// NOTE: I had to put this together to get the Teacher class working.
// Feel free to use this file or not, but please note that the
// Teacher.h/.cpp files depend on these exact functions and
// function names, so please use these names in the final class.
//
// Thanks! -Andrew
// ***********************************************************************
#include <string>
class
Student
{
public:
//Default constructor for only a username
Student
(
string
userNameIn
)
{
userName
=
userNameIn
;
}
// Default constructor for a username and level
Student
(
string
userNameIn
,
int
levelIn
)
{
userName
=
userNameIn
;
level
=
levelIn
;
}
// Accessors
int
getLevel
()
{
return
level
;
}
string
getUserName
()
{
return
userName
;
}
// Mutators
void
setLevel
(
int
levelIn
)
{
level
=
levelIn
;
}
void
setUserName
(
string
userNameIn
)
{
userName
=
userNameIn
;
}
private:
string
userName
;
int
level
=
1
;
};
Teacher.cpp
View file @
6492841b
#include "Teacher.h"
#include <iostream>
#include <fstream>
#include <chrono>
#include <ctime>
ofstream
fout
;
ifstream
fin
;
...
...
@@ -22,15 +24,29 @@ void Teacher::displayMenu() {
}
void
Teacher
::
displayProgress
()
{
cout
<<
"------STUDENT GRADEBOOK------
\n
"
;
cout
<<
"Student
\t\t
Current Level
\n
"
;
for
(
int
i
=
0
;
i
<
roster
.
size
();
i
++
)
{
cout
<<
roster
.
at
(
i
).
getUserName
()
<<
"
\t\t
"
<<
roster
.
at
(
i
).
getLevel
()
<<
endl
;
cout
<<
userName
<<
"'s Class Progress Report"
<<
endl
<<
endl
;
cout
.
width
(
10
);
cout
<<
left
<<
"Student"
<<
"|
\t
"
<<
"Current Level
\n
"
;
cout
<<
"-----------------------------
\n
"
;
for
(
int
i
=
0
;
i
<
roster
.
size
();
i
++
)
{
cout
.
width
(
10
);
cout
<<
left
<<
roster
.
at
(
i
).
getUserName
()
<<
"|
\t
"
<<
roster
.
at
(
i
).
getLevel
()
<<
endl
;
}
}
void
Teacher
::
exportProgress
()
{
fout
.
open
(
"classProgress.txt"
);
fout
<<
userName
<<
"'s Class Progress Report"
<<
endl
<<
endl
;
fout
.
width
(
10
);
fout
<<
left
<<
"Student"
<<
"|
\t
"
<<
"Current Level
\n
"
;
fout
<<
"-------------------------
\n
"
;
for
(
int
i
=
0
;
i
<
roster
.
size
();
i
++
)
{
fout
.
width
(
10
);
fout
<<
left
<<
roster
.
at
(
i
).
getUserName
()
<<
"|
\t
"
<<
roster
.
at
(
i
).
getLevel
()
<<
endl
;
}
fout
.
close
();
}
void
Teacher
::
saveProgress
()
{
...
...
@@ -103,7 +119,7 @@ void Teacher::adjustProgress(string studentUserNameIn, int level) {
}
void
Teacher
::
endProgram
()
{
saveProgress
();
}
// Accessors
...
...
Teacher_Driver.cpp
View file @
6492841b
...
...
@@ -21,7 +21,7 @@ int main() {
cout
<<
"The test teachers name is "
<<
testTeacher
.
getUserName
()
<<
".
\n\n
"
;
cout
<<
"Display Menu:
\n
"
;
//
cout << "Display Menu:\n";
//testTeacher.displayMenu();
...
...
@@ -45,7 +45,7 @@ int main() {
// testTeacher.adjustProgress("Andrew",5);
testTeacher
.
displayProgress
();
testTeacher
.
exportProgress
();
// testTeacher.saveProgress();
return
0
;
...
...
classProgress.txt
0 → 100644
View file @
6492841b
Andrew's Class Progress Report
Student | Current Level
-------------------------
sextsa | 1
tituja | 3
sacalu | 1
allsna | 3
sextja | 1
mamatt | 2
culvxa | 3
duerwe | 1
inghro | 2
umalno | 1
grifno | 1
levina | 4
classRoster.txt
View file @
6492841b
Andrew Quit
Andrew 1
Asher 3
Joe 1
John 3
sextsa 1
tituja 3
sacalu 1
allsna 3
sextja 1
mamatt 2
culvxa 3
duerwe 1
inghro 2
umalno 1
grifno 1
levina 4
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