Skip to content

Commit

Permalink
Merge pull request #32 from RounakNeogy/patch-2
Browse files Browse the repository at this point in the history
I have updated the scheduler function
  • Loading branch information
anushka23g authored Jan 22, 2021
2 parents 13c3535 + fbfa67c commit 9a5749a
Showing 1 changed file with 16 additions and 25 deletions.
41 changes: 16 additions & 25 deletions test-prep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ void printJobScheduling(subject arr[], int n)
for (int i=n-1; i>=0; i--)
{
if (slot[i])
{ cout <<i;
cout << arr[result[i]].sname << "\n";}
{
cout << arr[result[i]].sname << "\n";
}
}
}

Expand Down Expand Up @@ -177,12 +178,8 @@ void user_feedback(){


/*
end
COMPLETE FOR 1 SUBJECT
*/


Expand Down Expand Up @@ -318,53 +315,48 @@ int main()
}
int date;

cout << "Enter today's date (Format: dd):\n ";
cout << "Enter today's date (Format: dd): ";
cin >> date;
int month;
cout<<"Enter the month (Format: mm):\n";

cout<<"Enter the month (Format: mm): ";
cin>>month;

int tgive;

cout << "How much time can you give each day to studies( in hours ): ";
cout << "How much time can you give each day to studies(in hours): ";
cin >> tgive;

cout << "Enter the date and month for the following exams: \n";

for (int i = 0; i < n; i++)
{
cout << s[i].sname << "\n enter date: ";
cout << s[i].sname << ":\nenter date: ";

cin >> s[i].examdate;
cout << "enter month: ";
cin>>s[i].exam_month;

s[i].time_left = s[i].examdate - date + 1; //// changed the -1 to +1 for resolving error (RTE)

cout << "\n enter month: ";
cin>>s[i].exam_month;


if(s[i].exam_month==month){//calculating the time left if the exam is on the same month as the date
s[i].time_left=s[i].examdate-date+1;
cout<<"time left:"<<" "<<s[i].time_left<<" days"<<endl;
}

else if(s[i].exam_month>month){//calculating the time left if the exam is scheduled in later months
if(s[i].examdate>date){
int month_value=s[i].exam_month-month;
s[i].time_left = month_value*(30+abs(s[i].examdate - date + 1));
cout<<"time left: "<<s[i].time_left<<" days"<<endl;
}
}
else{
s[i].time_left=30-date+s[i].examdate+1;
cout<<"time left: "<<s[i].time_left<<" days"<<endl;
}
}

}

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;
Expand All @@ -373,16 +365,15 @@ int main()
{
cout << s[i].sname << ": ";
cin >> s[i].prep;
s[i].imp = s[i].credits / ((s[i].prep) * (s[i].time_left));
s[i].imp = s[i].credits*ttime / ((s[i].prep) * (s[i].time_left)); // calculating importance of each subject
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:\n ";
cout << "Complete the subjects in the following sequence to maximize your percentage:\n";

printJobScheduling(s, n);
}
Expand Down

0 comments on commit 9a5749a

Please sign in to comment.