forked from anushka23g/Learning-Made-Easy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-prep.cpp
More file actions
268 lines (196 loc) · 7.32 KB
/
Copy pathtest-prep.cpp
File metadata and controls
268 lines (196 loc) · 7.32 KB
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
#include <bits/stdc++.h>
#include "include/mmaker.h"
#include "include/func.h"
#include "include/classes.h"
#include "include/functions.h"
using namespace std;
int main()
{
int option;
cout << "------------MENU------------\n";
cout << "\nEnter the number as follows:\n";
cout << "0 to schedule studies for all subjects for a long period of time\n1 to schedule a given subject in limited time\n2 for mixed schedule of all subjects(if you have enough time)";
cout << "\n---- ";
cin >> option;
if (option == 1)
{
int n;
cout << "Enter the no. of topics: ";
cin >> n;
int total_diff = 0; // sp
topic t[2 * n];
cout << "Enter name of each topic: ";
for (int i = 0; i < n; i++)
{
cin >> t[i].name;
}
cout << "Enter priority of each topic i.e. expected weightage: ";
for (int i = 0; i < n; i++)
{
cout << t[i].name << " : ";
cin >> t[i].priority;
t[i].weightage = t[i].priority;
t[i].count = 0;
}
cout << "Enter difficulty level of each topic based on your own understanding from(1-10) 1 being the easiest: ";
for (int i = 0; i < n; i++)
{
cout << t[i].name << " : ";
cin >> t[i].difficulty;
total_diff = total_diff + t[i].difficulty;
}
total_diff = total_diff + total_diff / 2;
int total_time; // tt
int focused_time; // eff
cout << "Enter total time available to study this subject in hours: ";
cin >> total_time;
cout << "How much you can resist yourself from using phone during exams?(1-10): ";
cin >> focused_time;
float available_time = total_time * focused_time / 10; //at
cout << "Allotted time: " << available_time << "\n";
cout << "Difficulty Level: " << total_diff << "\n";
float utilised_val = available_time / total_diff; //ut
cout << "Utilization Time: " << utilised_val << "\n";
for (int i = 0; i < n; i++)
{
t[i].time = utilised_val * t[i].difficulty / 10;
cout << t[i].name << " " << t[i].time * 10 << "\n";
}
int checksub;
cout << "The time is: ";
cout << "Please check if you will be able to complete the topics in the given time \nIf okay press 1 else press 0: ";
for (int i = 0; i < n; i++)
{
cout << t[i].name << " " << t[i].time << "\n";
}
cin >> checksub;
if (checksub == 0)
{
cout << "You can enter the time manually: ";
for (int i = 0; i < n; i++)
{
cin >> t[i].time;
}
}
for (int i = n; i < 2 * n; i++)
{
t[i].name = t[i - n].name;
t[i].priority = t[i - n].priority / 2;
t[i].weightage = 0;
t[i].difficulty = t[i - n].difficulty / 2;
t[i].time = t[i - n].time / 2.0;
t[i].count = 1;
}
// (value,weight)----(priority,time)
// capacity-tt
//revision of each subject has a priority and time half of the subject
double prepared = fractionalKnapsack(available_time, t, 2 * n);
cout << prepared;
return 0;
}
else if (option == 0)
{
int n;
cout << "Enter total no. subjects: ";
cin >> n;
subject s[n];
int tcred = 0;
cout << "Enter name and credits for each subject: ";
for (int i = 0; i < n; i++)
{
cin >> s[i].sname >> s[i].credits;
tcred += s[i].credits;
}
int date;
cout << "Enter today's date (Format: dd): ";
cin >> date;
int tgive;
cout << "How much time can you give each day to studies( in hours ): ";
cin >> tgive;
cout << "Enter the date for the following exams (Format: dd)\n";
for (int i = 0; i < n; i++)
{
cout << s[i].sname << ":";
cin >> s[i].examdate;
s[i].time_left = s[i].examdate - date - 1;
}
int ttime = s[0].time_left * tgive;
cout << "How much previous preparation do you have on a scale of 1 to 10? \n10 being highest and 1 being the lowest: \n";
int timp = 0;
for (int i = 0; i < n; i++)
{
cout << s[i].sname << ": ";
cin >> s[i].prep;
s[i].imp = s[i].credits / ((s[i].prep) * (s[i].time_left));
s[i].profit = s[i].credits / s[i].prep;
timp += s[i].imp;
s[i].stime = s[i].credits * ttime / s[i].prep;
//cout<<s[i].sname<<" "<<s[i].credits<<" "<<s[i].profit<<" "<<s[i].stime<<" "<<s[i].prep<<" "<<s[i].time_left<<endl;
}
cout << "Complete the subjects in the following sequence to maximize your percentage: ";
printJobScheduling(s, n);
}
//mixed scheduling of all subjects
else if (option == 2)
{
int ask;
//do all difficult chapters together
int n;
cout << "Enter total no. subjects: ";
cin >> n;
subject s[n];
int ttopic = 0;
cout << "Enter name of the subject,credits and no. of topics in each subject: ";
for (int i = 0; i < n; i++)
{
cin >> s[i].sname >> s[i].credits >> s[i].topics;
ttopic += s[i].topics;
}
cout << "\n";
sort(s, s + n, cmpsub);
//cout<<"sorted on basis of course credits";
//cout<<"ttopic is"<<ttopic;
/*
for(int i=0;i<n;i++)
{
cout<<s[i].sname<<"\n";
cout<<s[i].topics<<"\n";}*/
topic it[ttopic * n];
int y = 0;
for (int i = 0; i < n; i++)
{
cout << "Enter name of each topic with its weightage in exam and difficulty level for you (from 1-10 \n 1 being the easiest) for the subject\n ";
cout << s[i].sname << ": ";
for (int j = 0; j < s[i].topics; j++)
{
cin >> it[y].name >> it[y].weightage >> it[y].difficulty;
it[y].imp = it[y].weightage * s[i].credits * it[y].difficulty;
y++;
}
}
cout << "Do you want to do major chapters first ( press 1 ) or the most difficult ones (press 0)? ";
cin >> ask;
if (ask == 0)
{
//sort on the basis of difficulty
sort(it, it + (n * ttopic), cmpDiff);
cout << "Sorted by difficulty in each topic faced by you:\n";
for (int i = (n * ttopic) - 1; i >= 0; i--)
{
cout << it[i].name << "\n";
}
}
else if (ask == 1)
{
//sort on the basis of importance
sort(it, it + (n * ttopic), cmpImp);
cout << "Sorted by importance of each subject in exam:\n";
for (int i = (n * ttopic) - 1; i >= 0; i--)
{
cout << it[i].name << "\n";
}
}
}
user_feedback();
return 0;
}