Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help me to understand this code, if u dont mind explain the whole code,if not just explain the interface part and LQueue part bcz i

Help me to understand this code, if u dont mind explain the whole code,if not just explain the interface part and LQueue part bcz i didnt understand that part

based of this output

image text in transcribed

Code:

Main.cppimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedShift.himage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedLQueue.himage text in transcribedimage text in transcribedimage text in transcribedNPQueue.h

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedWorkCal.h //in case if you guys need

image text in transcribedimage text in transcribedimage text in transcribed

No of days :5 No of Staffs: 5 Min offdays for staff: 2 Min Staffs required per day: 3 Number of shifts: 3 Start Date: Year Month Day: 2018 1 1 Date Set Staff Schedule Staffs Date Daysse S1 S2 S3 S4 1 /1 [Mon] 1 DM D 3 2 /1 (Tue] 2 DX N DX 3/1 [Wed] 3 X NX M N 3 4 /1 [Thu] 4 N X M X D 5 /1 [Fri] 5 DM D X 3 Shiftsworked 3 3 3 3 Offdays 2 2 2 2 wwwwww Options: 1: ApplyLeave 2: FillDay 3: Display Schedule 4: Display Day Schedule 5: Display Staff Schedule 6: Exit DEV - x C:\Semester 3\Project\ShiftM\Main.cpp - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help EE 1. O X TDM-GCC 4.9.2 64-bit Release JU (globals) Project Classes Debug Main.cpp Shift.h WorkCal.h LQueue.h NPQueue.h 2 #include 3 #include 4 #include "Shift.h" 5 #include "Workcal.h" 6 using namespace std; 7 8 string marker(int s) { 9 string m = ""; 10 if (s== || s==1) {return "X";} 11 if (s==-1) {return "L";} 12 if (sX3 ==0) { m = 'N'+m; } 13 if (s%5 ==0) { n = 'D'+m;} 14 if (s*7 ==0) { m = 'M'+m; } 15 if (s%11 ==0){ m = 'E'+m;} 16 return m; 17 } 18 string week[7] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; 19 20 class ShiftManagement { 21 public: 22 Shift shift; 23 int days, N, k, aw, s; 24 public: 25 ShiftManagement() { 26 cout > days; 29 cout> N; 31 cout> k; 33 cout> aw; 35 cout> S; 37 shift.set(days, N, k, aw, s); chifu cchedulall. 88 Compiler Resources oh Compile Log Debug Find Results 28 Activate Windows Go to Settings to activate Windows. Line: 1 Col: 1 Sel: 0 Lines: 171 Length: 4726 Insert Done parsing in 0,016 seconds DEV - x C:\Semester 3\Project\ShiftM\Main.cpp - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help 1. O TDM-GCC 4.9.2 64-bit Release JU (globals) 11 11 Project Classes Debug Main.cpp Shift.h WorkCal.h LQueue.h NPQueue.h 36 cin>> s; 37 shift.set(days, N, k, aw, 5); 38 shift schedule(); 39 SetStartDate(); 40 Display(); 41 choice(); 42 } 43 void choice() { 44 int ch; 45 cout >>>"; 53 cin >> ch; 54 switch(ch) { 55 case 1: 56 ApplyLeave(); 57 choice(); 58 case 2: 59 FillDay(); 60 choice(); 61 case 3: 62 Display(); 63 choice(); 64 case 4: 65 DaySchedule(); 66 choice); 67 case 5: 68 StaffSchedule(); 69 choice(); 70 case 6: 71 exit(); defaul+ :: Compiler Resources oh Compile Log Debug Find Results 72 Activate Windows Go to Settings to activate Windows. Line: 1 Col: 1 Sel: 0 Lines: 171 Length: 4726 Insert Done parsing in 0,016 seconds C:\Semester 3\Project\ShiftM\Main.cpp - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help - x HA O E TDM-GCC 4.9.2 64-bit Release JU (globals) Project Classes Debug Main.cpp Shift.h WorkCal.h LQueue.h NPQueue.h 71 exit(); 72 default: 73 cout > day; 112 cout > sid; 118 cout> day; 120 shift. leave(sid, day); 121 cout > year >> >> day: 128 shift.setStartDate(year, month, day); 129 cout > day; 135 Date temp = shift. shiftcal().workday (day); 136 std::cout> staff; 154 std::cout 2 #include #include "Workcal.h" 4 #include "NP/NPQueue.h" 5 #ifndef SHIFT_H 6 #define SHIFT_H 7 using namespace std; 8 9 class Shift{ 10 public: 11 int days; // num of work days 12 int N; // num of staff 13 int k; // min offdays required per staff 14 int aw; // min staff required per day 15 int curr; // working day 16 int num_shifts; // num of shifts in a day 17 bool doubleshift; 18 WorkCal cal; 19 int** shifts; // matrix of day staff shifts 20 NPQueue priorStaff; // priorityqueue for staffs 21 NPQueue priorDay; // priorityqueue for days 23 public: 24 Shift({} 25 Shift(int days, int n, int k, int aw, int num_shifts){ 26 set (days, N, k, aw, num_shifts); 27 schedule(); 28 29 Shift({ 30 for(int i = 0; i days = days; this->k = k; 39 this->N = N; this->aw = aw; 41 this->num_shifts = num_shifts; this->doubleshift = num_shifts > 2; // enable double shift if num_shifts>2 this->curr = 0; this->cal = Workcal(); this->shifts = new int*[days+2]; 46 for (int j=0; j2 ? 5-1:5=; 58 for (int i=0; i=aw){ 72 for (int i=0; i=0 && wid 1){ leavehelp(wid, day); 90 shifts[day-1] [wid] = -1; // Leave representation = -1 91 // find off day for staff 93 int getdayoff (int wid){ 94 assert(wid>=0 && wid=curr && shifts[day][wid]>0 && // staff has to have only one shift on that day 98 A shifts[day] [wid]=0 && day-1=0 && day-11 && shifts[day-1] [s]=0 && day-1=0 && wid 11 ? ns2:ns=ns; 194 shifts[days+1] [wid] += 1; // increase off day for staff 195 int prior = 2*(days-k)-shifts[days] [wid]; // current priority of staff 196 shifts[day] [wid] -=ns; priorStaff.pup(wid, prior, ns); // decrease shift worked and increase priority for staff by ns 197 priorDay.pdown (day-1, shifts[day-1][N], ns); // decrease priority for day by ns 198 shifts[day-1] [N] -=ns; // decrease num staff 199 shifts[day-1][wid] = -1; 200 if(shifts[day-1][N] 2 #include 3 #ifndef LQueue_H 4 4 #define LQueue_H 5 6 // Singly linked node 79 template class Link{ 8 public: 9 E element; 10 Link *next; 11 // Constructors 12 Link (const E& elemval, Link* nextval = NULL) { 13 element = elemval; 14 next = nextval; 15 } 16 Link(Link* nextval=NULL) { next = nextval;} 17 }; 18 19 // Linked Queue 20 template 21 class LQueue { public: 23 Link* head; 24 Link* tail; 25 Link* curr; int cnt; 27 28 void init() { 29 curr = tail = head = new Link; 30 cnt = 0; 31 } 32 void removeall() { 33 while( head != NULL) { 34 curr = head; 35 head = head -> next; 36 delete curr; 22 26 27 1 Activate Windows Go to Settings to activate Windows. :: Compiler Resources oh Compile Log Debug Find Results Line: 1 Col: 1 Sel: 0 Lines: 107 Length: 2714 Insert Done parsing in 0,016 seconds DEV C:\Semester 3\Project\ShiftM\NP\LQueue.h - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help - x 1. O TDM-GCC 4.9.2 64-bit Release JU (globals) Project Classes Debug Main.cpp Shift.h WorkCal.h LQueue.h NPQueue.h 37 38 } 39 public: 40 LQueue () { init(); } 41 -LQueue() { removeall(); } 42 43 // Insert 44 void enqueue (const E& it){ 45 curr = tail; 46 curr->next = new Link(it, curr->next); 47 tail = curr->next; 48 cnt++; 49 curr = head; 50 } 51 - E dequeue() { 52 // find correct pos for it 53 curr=head; 54 Link* ltemp = curr->next; 55 E it - ltemp-element; 56 curr->next = ltemp->next; 57 delete ltemp; 58 return it; 59 } 60 // Remove element 61 void remove(const E& it) { 62 //assert(curr->next != NULL); 63 curr - head; 64 while (curr!=tail){ 65 if (it == curr->next->element) { 66 Link* ltemp = curr->next; 67 if (tail == curr-> next) tail = curr; 68 curr->next = curr->next->next; 69 delete ltemp; 70 cnt- 71 break; 72 } // set curr to head Il store top priority node // store element of top priority // set curr-> next to second priority node // delete Ltemp // return key of top node 72 CUR Currenevt. Activate Windows Go to Settings to activate Windows. 88 Compiler Resources oh Compile Log Debug Find Results Line: 1 Col: 1 Sel: 0 Lines: 107 Length: 2714 Insert Done parsing in 0,016 seconds C:\Semester 3\Project\ShiftM\NP\LQueue.h - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help - x 1. O dh TDM-GCC 4.9.2 64-bit Release JU (globals) Project Classes Debug Main.cpp Shift.h WorkCal.h LQueue.h NPQueue.h 72 } 73 curr = curr->next; 74 } 75 76 void prev { 77 Link* temp = head; 78 while (temp->next!=curr) temp=temp->next; 79 curr = temp; 80 81 void next() { 82 if (curr != tail) curr = curr->next; 83 84 int length() const { return cnt; } 85 int currpos() const{ 86 Link* temp = head; 87 int i; 88 for(i=0; curr!=temp; i++) 89 temp = temp->next; 90 return i; 91 92 const E& top() { 93 curr = head; 94 return curr->next->element; 95 96 const E& getNext() { 97 assert(curr->next != NULL); 98 if (curr != tail) curr = curr->next; 99 return curr->next->element; 100 101 const E& getKey() const { 102 assert(curr->next != NULL); 103 return curr->next->element; 104 105 106 }; 107 #endif Activate Windows Go to Settings to activate Windows. 88 Compiler Resources oh Compile Log Debug Find Results Line: 1 Col: 1 Sel: 0 Lines: 107 Length: 2714 Insert Done parsing in 0,016 seconds C:\Semester 3\Project\ShiftM\NP\NPQueue.h - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help - x 1. O dh TDM-GCC 4.9.2 64-bit Release 0 (globals) Project Classes Debug Main.cpp Shift.h WorkCal.h LQueue.h NPQueue.h 1 #include 2 #include #include "LQueue.h" 4 #ifndef NPQueue_H #define NPQueue_H 6 7 template class QLink{ 8 public: 9 P priority; // priority value 10 LQueue* queue; // Linked queue to store elements 11 QLink *prev; 12 QLink *next; 13 // Constructors 14 QLink(const priorval, QLink* preval = NULL, QLink* nextval = NULL) { 15 priority - priorval; 16 queue = new LQueue(); prev = preval; next = nextval; 24 25 26 27 28 29 30 31 QLink(QLink* preval = NULL, QLink* nextval=NULL) { queue = new LQueue(); prev = preval; next = nextval;} }; // Double Linked template class NPQueue { private: QLink* head; QLink* tail; QLink* curr; // pointer to priority Qlink node Link* currElem; // pointer to element Link node int cnt; // total elements in queue void init() { curr = head = new QLink; tail = new QLink(head); curr->next = tail; cnt = 0; 33 34 35 36 27 void ramavaal1/ Activate Windows Go to Settings to activate Windows. 88 Compiler Resources oh Compile Log Debug Find Results Line: 21 Col: 3 Sel: 0 Lines: 196 Length: 7714 Insert Done parsing in 0,016 seconds DEV - x C:\Semester 3\Project\ShiftM\NP NPQueue.h - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help TDM-GCC 4.9.2 64-bit Release JU (globals) Project Classes Debug Main.cpp Shift.h WorkCal.h LQueue.h NPQueue.h 36 } 37 void removeall({ 38 //clear(); 39 delete head; 40 delete tail; 41 } 42 public: 43 NPQueue () { init(); } 44 -NPQueue () { removeall(); } 45 46 // inserting in priority position considering fifo 47 void enqueue (const E& it, const P& pt ) { 48 bool exist = false; 49 curr=head; // point to head 50 int i=0; 51 while(curr->next!-tail){ // Loop until curr->next is tail 52 if (pt == curr->next->priority) { // if node with pririty pt present 53 curr->next->queue-enqueue (it); // enqueue it to it 54 exist = true; break; 55 } 56 if (pt> curr->next->priority) { break; } // if pt > curr next priority break Loop 57 curr = curr->next; 58 } 59 if (!exist) { // if priority node doesnot exist 60 QLink* temp = new QLink(pt, curr, curr->next); // create new node 61 curr->next = curr->next->prev = temp; 62 temp->queue->enqueue(it); // enqueue it to the node 63 curr->queue->tail->next = temp->queue->head->next; // set tail next of curr node's queue to head next of new 64 temp->queue->tail->next = temp->next->queue->head->next; // set tail next of new node's queue to head next of node after 65 } 66 cnt++; 67 } 68 69 // remove top priority element 70 A E dequeue() { 71 curr - head; // set curr to head Activate Windows olinLED * 1+amn - CHIRP- navt. 11 stars tan nriaritunado :: Compiler Resources oh Compile Log Debug Find Results Go to Settings to activate Windows. Line: 21 Col: 3 Sel: 0 Lines: 196 Length: 7714 Insert Done parsing in 0,016 seconds 72 C:\Semester 3\Project\ShiftM\NP\NPQueue.h - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help - x 1. O TDM-GCC 4.9.2 64-bit Release // set curr to head sterection for bready node // set curr-> next to second priority node // set prev of second priority node to curr // delete Ltemp Il return key of top node // Loop until head->next is tail Il set curr to head->next // set head->next to link after // delete curr JU (globals) Project Classes Debug Main.cpp Shifth WorkCal.h LQueue.h NPQueue.h 71 curr = head; 72 QLink* ltemp = curr->next; 73 LQueue* qtemp - ltemp->queue; 74 E it = qtemp->dequeue(); 75 if (temp->length()==0){ 76 curr->next = ltemp->next; 77 curr->next->prev - curr; 78 delete ltemp; 79 } 80 return it; 81 82 // clear all the elements and its priority 83 void clear() { 84 while( head->next != tail){ 85 curr = head -> next; 86 head -> next = head -> next -> next; 87 delete curr; 88 89 tail->prev = head; 90 } 91 92 // returns the pos of priority node if present 93 int find(const pt) { 94 int i=0; 95 curr = head; 96 while (curr->next!-tail){ 97 if (pt == curr->next->priority) { return i;} 98 curr = curr->next; 99 i++; 100 } 101 return -1; 102 103 void remove(const E& it, const P& pt) { 104 if (find(pt)!=-1){ 105 QLink* ltemp = curr->next; 106 ltemp->queue->remove(it); 107 if (1 tamn. Helenth/ --AVS H: Compiler Resources dh Compile Log Debug Find Results // set tail->prev to head // find pt // store QLink node // remove it from QLink // if no element in olin remove olib Activate Windows Go to Settings to activate Windows. Line: 21 Col: 3 Sel: 0 Lines: 196 Length: 7714 Insert Done parsing in 0,016 seconds - 117 C:\Semester 3\Project\ShiftM\NP\NPQueue.h - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help 88 O 18 TDM-GCC 4.9.2 64-bit Release JU (globals) Project Classes Debug Main.cpp Shift.h WorkCal.h LQueue.h NPQueue.h 106 Itemp->queue->remove(it); // remove it from QLink 107 if (itemp->queue->length() ==0){ // if no element in QLink remove QLink 108 curr->next = ltemp->next; // set curr-> next to second priority node 109 curr->next->prev = curr; // set prev of second priority node to curr 110 delete ltemp; Il delete Ltemp 111 112 curr->queue->tail->next = curr->next->queue->head->next; // set curr tail next to curr next head next 113 cnt--; 114 } 115 116 void insert(const E& it, const P& newpt) { 118 QLink(newpt, curr, curr->next); // create QLink with curr as prev and curr->next as next 119 curr->next curr->next->prev = temp; // set curr->next and curr->next->prev to new QLink 120 temp->queue-enqueue(it); // enqueue it to Qlink 121 curr->queue->tail->next = temp->queue->head->next; // point curr tail next to new QLink head next 122 temp->queue->tail->next = temp->next->queue->head->next; // point new QLink tail next to Qlink after head next 123 cnt++; 124 125 // increase the priority of element 126 void pup(const E& it, const P& pt, const P& inc=1){ 127 // Loop through list to find element it 128 remove(it, pt); 129 P newpt = pt+inc; 130 bool exist =false; 131 while(curr!=head) { // find correct pos for it 132 if (newpt == curr->priority) { // if Qlink with priority newpt exist 133 curr->queue->enqueue (it); // enqueue it 134 exist=true; cnt++; 135 break; 136 137 if (newpt priority) { break; } // if newpt priority break Loop 138 curr = curr->prev; 139 140 if(!exist){ insert(it, newpt); } // if doesnot exist insert it with priority newpt 141 top(); Activate Windows 88 Compiler Resources oh Compile Log Debug Find Results Go to Settings to activate Windows. Line: 21 Col: 3 Sel: 0 Lines: 196 Length: 7714 Insert Done parsing in 0,016 seconds 147 - x C:\Semester 3\Project\ShiftM\NP\NPQueue.h - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help 1. O TDM-GCC 4.9.2 64-bit Release JU (globals) Project Classes Debug Main.cpp Shift.h WorkCal.h LQueue.h NPQueue.h 141 top(); 142 143 144 // decrease the priority of element 145 void pdown (const E& it, const P& pt, const P& dec=1){ 146 remove(it, pt); 147 P newpt = pt-dec; 148 bool exist =false; 149 while(curr->next!-tail){ // find correct pos for it 150 if (newpt == curr->next->priority){ // if QLink with priority newpt exist 151 curr->next->queue->enqueue (it); // enqueue it 152 exist = true; cnt++; 153 break; 154 } 155 if (newpt> curr->next->priority) { break; } // if newpt > curr->next->priority break Loop 156 curr = curr->next; 157 } 158 if(!exist){ insert(it, newpt); } // if doesnot exist insert it with priority ne 159 top(); 160 161 // get top priority element 162 const E& top() { 163 curr = head; 164 currElem = curr->next->queue->head; 165 return currElem->next->element; 166 167 // get next element 168 const E& getNext() { 169 if (currElem->next !=NULL) { 170 currElem = currElem->next; 171 } 172 return currElem->next->element; 173 174 // get key 175 const E& getKey() const { 176 assert(currElem->next != NULL); return currflam- navt-lalamant. :: Compiler Resources dh Compile Log Debug Find Results Line: 21 Col: 3 Sel: 0 Lines: 196 Length: 7714 Insert Done parsing in 0,016 seconds 177 Activate Windows Go to Settings to activate Windows. - x C:\Semester 3\Project\ShiftM\NP\NPQueue.h - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help PE 88 O BE dh TDM-GCC 4.9.2 64-bit Release JU (globals) Project Classes Debug Main.cpp Shifth WorkCal.h LQueue.h NPQueue.h 161 // get top priority element 162 const E& top() { 163 curr = head; 164 currElem = curr->next->queue->head; 165 return currElem->next->element; 166 167 Il get next element 168 const E& getNext() { 169 if (currElem->next!=NULL) { 170 currElem = currElem->next; 171 } 172 return currElem->next->element; 173 174 // get key 175 const E& getKey() const 176 assert(currElem->next != NULL); 177 return currElem->next->element; 178 179 // get priority value 180 const P& getPValue() const { 181 assert(curr->next != tail); 182 return curr->next->priority; 183 184 // move to previous 185 void prev(){ 186 if (curr != head) curr = curr->prev; 187 188 // move to next 189 void next({ 190 if (curr->next != tail) curr = curr->next; 191 192 // Length of the queue 193 int length() const { return cnt; } 194 195 }; 196 #endit Activate Windows Go to Settings to activate Windows. :: Compiler Resources oh Compile Log Debug Find Results Line: 176 Col: 38 Self 0 Lines: 196 Length: 7714 Insert Done parsing in 0,016 seconds - x C:\Semester 3\Project\ShiftM\WorkCal.h - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help HA O E dh TDM-GCC 4.9.2 64-bit Release JU (globals) Project Classes Debug 4 Main.cpp Shift.h WorkCal.h LQueue.h NPQueue.h 1 // module for workday calander 2 #include 3 #include #include 5 #ifndef WORKCAL H 6 #define WORKCAL_H 7 8 9 // Date Class 10 class Date { 11 public: 12 Il member variables 13 int day, month, year, weekday; 14 public: 15 // constructor 16 - Date(){ 17 std::time_t t = std::time(); 18 std::tm* now = std:: localtime(&t); 19 this->day = now->tm_mday; 20 this->month = now ->tm_mon + 1; this->year = now->tm_year + 1900; this->weekday = now->tm_wday; 26 27 28 Date(int year, int month, int day >{ std::tm time_in = { 0, 0, , day, month-1, year 1900 }; std::time_t time_temp = std:: mktime(&time_in); const std::tm * time_ptr = std::localtime(&time_temp); this->day = day; this->month = month; this->year = year; this->weekday = time_ptr->tm_wday; Date(const Date& obj){ this->day = obj.day; thic-month - mi month. Activate Windows Go to Settings to activate Windows. 9. Compiler Resources dh Compile Log Debug . Find Results Line: 1 Col: 1 Sel: 0 Lines: 82 Length: 2422 Insert Done parsing in 0,016 seconds C:\Semester 3\Project\ShiftM\WorkCal.h - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help - x 1. O TDM-GCC 4.9.2 64-bit Release JU (globals) Project Classes Debug Main.cpp Shift.h WorkCal.h LQueue.h NPQueue.h 37 this->month = obj.month; 38 this->year = obj.year; 39 this->weekday = obj.weekday; 40 } 41 42 int Day(){ return day; } 43 int Month(){ return month; } 44 int Year() { return year; } 45 int Weekday(){ return weekday; } 46 47 }; 48 49 class WorkCal { 50 private: 51 Date startday; 52 bool leap(int year){ 53 return (year % 4==@)&&(yearX100!=0)||(year%400==0); 54 55 public: 56 Workcal(){ 57 startday = Date(); 58 59 Workcal(int year, int month, int day) { 60 startday = Date(year, month, day); 61 62 // get date of workday 63 - Date workday (int day){ 64 Date date = startday: 65 date.day = date.day + day - 1; 66 date.weekday = (date.weekday + day -1)X7; 67 int daysinMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 68 if (leap(date.year)) { daysinMonth[1]=29; } 69 70 while(date.day > daysinMonth(date.month-1]){ 71 date.day -= daysinMonth(date.month-1]; 72 date.month += 1; if (data manth--1215 88 Compiler Resources oh Compile Log Debug Find Results Line: 1 Col: 1 Sel: 0 Lines: 82 Length: 2422 Insert Done parsing in 0,016 seconds Activate Windows Go to Settings to activate Windows. C:\Semester 3\Project\ShiftM\WorkCal.h - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help - x 1. O TDM-GCC 4.9.2 64-bit Release 0 (globals) Project Classes Debug 54 i get date of workday Main.cpp Shift.h WorkCal.h LQueue.h NPQueue.h 47 L }; 48 49 class Workcal { 50 private: 51 Date startday; 52 bool leap(int year){ 53 return (year % 4==@)&&(year%100!=0)||(yearX400==6); } 55 public: 56 Workcal(){ 57 startday = Date(); 58 } 59 Workcal(int year, int month, int day) { 60 startday = Date(year, month, day); 61 62 63 Date workday (int day){ 64 Date date = startday; 65 date.day = date.day + day - 1; 66 date.weekday = (date.weekday + day -1)X7; 67 int daysinMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 32, 31}; 68 if (leap(date.year)) { daysinMonth[1]=29; } 69 70 while(date.day > daysinMonth[date.month-1]){ 71 date.day -= daysinMonth(date.month-1]; 72 date.month += 1 73 - if (date.month= 13) { date.year += 1; 75 date.month = 1; 76 if (leap(date.year)){ daysinMonth[1]=29; } 77 78 } 79 return date; 80 81 }; 82 #endif 74 Activate Windows Go to Settings to activate Windows. 88 Compiler Resources oh Compile Log Debug Find Results Line: 1 Col: 1 Sel: 0 Lines: 82 Length: 2422 Insert Done parsing in 0,016 seconds<><><><>

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems Second East European Symposium Adbis 98 Poznan Poland September 1998 Proceedings Lncs 1475

Authors: Witold Litwin ,Tadeusz Morzy ,Gottfried Vossen

1st Edition

3540649247, 978-3540649243

More Books

Students also viewed these Databases questions

Question

Helping difficult people on the job.

Answered: 1 week ago

Question

1. How might volunteering help the employer and the employee?

Answered: 1 week ago