-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain
162 lines (138 loc) · 4.47 KB
/
main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
//Final project main
#include <string>
#include <cstdlib>
#include <iostream>
#include <vector>
#include "Assignment.h"
#include "Test.h"
using namespace std;
int main () {
string answer;
while(answer != "no") {
if(answer == "new") {
cout<<"\tWould you like to grade a new assignment? (yes/no)\n\t";
cin>>answer;
if(answer == "no") {
break;
}
}
answer = "new";
string input;
int choice;
Assignment temp_assignment = Assignment("");
Test key = Test("key");
Test student_test = Test("");
while(input != "exit") {
cout << "\tEnter a number for what you would like to do:\n\t1. Enter Key\n\t2. Enter Test\n\t3. Calculate Statistics\n\t4. Omit a Question\n\t5. Add a Curve\n\t6. Print Grades and Statistics\n\texit\n\n\t";
cin >> input;
if (input == "exit") {
break;
}
if (input == "exit") {
break; //should break the loops if input is exit, otherwise continues to the switch case
} else {
choice = atoi(input.c_str());
}
switch ( choice ) {
case 1: //key
{
string temp_name;
string temp_file_name;
cout<<"Please enter a name for your assignment.\n";
cin>>temp_name;
temp_assignment.set_name(temp_name);
cout<<"Please input your test key file name.\n";
cin>>temp_file_name;
key.answer_input(temp_file_name);
}
break;
case 2: //enter tests
{
string student_name;
string student_file_name;
cout<<"Please enter the student's name\n";
cin>>student_name;
Test student_test = Test(student_name);
cout<<"Please input your student answer file name.\n";
cin>>student_file_name;
student_test.answer_input(student_file_name);
//begin grading student test, add mutator to assignment vector
temp_assignment.set_vector_index(student_test.grader(*student_test.get_vector(),*key.get_vector(), true));
temp_assignment.add_test(student_test);
}
break;
case 3: //calculator
{
temp_assignment.calculateHigh();
temp_assignment.calculateLow();
temp_assignment.calculateMean();
temp_assignment.calculateMode();
temp_assignment.calculateMedian();
temp_assignment.printStatistics();
}
break;
case 4: //omitter
{
int deletedIndex;
cout<<"\tPlease enter the question number that you would like to have omitted\n\t";
cin>>deletedIndex;
bool checker = false;
temp_assignment.omitQuestion(deletedIndex, key.student_answers, checker);
temp_assignment.calculateHigh();
temp_assignment.calculateLow();
temp_assignment.calculateMean();
temp_assignment.calculateMode();
temp_assignment.printStatistics();
//this should be able to ignore a specific questions weight on a grade,
//ideally not by just deleting the index at that point on the key/tests, then
//send the tests back through the grader code above
}
break;
case 5: //curver
//ask for what you want the median/mean/percentiles you want the test to
//be at. Then add points to all the tests (every indices in the array)
//accordingly
temp_assignment.calculateCurve();
break;
case 6: //printer
{
int input;
string assignment;
while(true){
cout << "\tAssignment name:\n\t";
cin >> assignment;
//Giving the user the option to exit back to the menu incase the assignment isn't in the system or hasn't been calculated
if(assignment.compare("Menu") == 0){
break;
} else if(assignment != "") { //Making sure the assignment exists and statistics have been calculated. Upperbound set to 200 incase scores are curved heavily
break;
} else {
cout << "\tThe assignment was not found or the statistics have not been calculated. Enter 'Menu' if you need to return.\n" << endl;
}
}
while(input != 3) {
cout << "\tEnter a number for what you would like to do:\n\t1. Display all Students and Scores\n\t2. Look up student score by name\n\t3. Exit\n\t";
string choice;
cin >> choice;
input = atoi(choice.c_str());
if(input == 3){
break;
}
switch ( input ) {
case 1: //printing all the grades for this particular assignment
temp_assignment.printGrades();
break;
case 2: //printing a specific student's grade
cout << "\tPlease input student's name below\n\t";
string sName;
cin>>sName;
temp_assignment.printStudentGrade(sName);
break;
}
}
}
break;
}
}
}
}