Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I already make a code calendar but my my teacher tell me that i must make a class calendar, and make my code ruined, i

I already make a code calendar but my my teacher tell me that i must make a class calendar, and make my code ruined, i need help about it

this is the task

Create the data structures You need a Date class, used for storing the date information (Year, Month, Day)You need an Event class, used for storing the event information (Date, Description)So, in your Calendar class, you need to have one Date object for storing the current date and a vector of Event class to store the Events you created.separate to calendar.h / calendar,cpp / main.cpp

and this is the code that a i already made it

Sorry system say is too long so some of the code i captured

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

//the continue of the code

int totald(int m, int y) { long unsigned td11 = 0; for (int i = 1990; i0) cout DEV - X TDM-GCC 4.9.2 64-bit Release Untitled1 - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help IOHC 2: O JU (globals) Project Classes Debug moga kek gini.cpp calender.h [*] Untitled1 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 9 10 using namespace std; 11 12 class Event { 13 private: 14 int id; 15 int day; 16 int month; 17 int year; 18 string description; 19 public: 20 Event() { 21 F} 22 Event(int a, int b, int c,string _d, int e) { 23 day = a; 24 month = b; 25 year = c; 26 description - _d; 27 id=b*10000+(a+31+e)*100+(cX100); 28 29 30 void setID(int id_){id=id_;} 31 void setDay(int a) { day = a; } 32 void setMonth(int a) { month = a; } 33 void setYear(int a) { year = a; } 34 35 int getDay() { return day; } 36 int getMonth() { return month; } 37 int getYear() { return year; } 38 int getID){return id;} 39 } Activate Windows Go to Settings to activate Windows, 88 Compiler Resources oh Compile Log Debug Find Results Line: 346 Col: 44 Sel: 0 Lines: 358 Length: 7571 Insert Done parsing in 1.532 seconds e ni PL K da DEV e P9 W C) ENG 2:05 AM 6/10/2020 DEV - TDM-GCC 4.9.2 64-bit Release Untitled1 - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help IOHC HA O EAA JU (globals) Project Classes Debug moga kek gini.cpp calender.h [*] Untitled1 39 40 void setDescription(string s) {description = s;} 41 string getDescription() {return description;} 42 }; 43 44 int totald(int, int); 45 void showc(int, int, int); 46 47 int main() 48 = { 49 50 vector events; 51 int m, y, dy 52 int n, p, C; 53 int d_,_,_; 54 string des; 55 time_t t=time(); 56 struct tm*now=localtime(&t); 57 y=now ->tm_year+1900; 58 n=now->tm_mon+1; 59 d=now->tm_mday; 60 61 d = totald(m, y); 62 showc(d, m, y); 63 char z; 64 do 65 66 z = cin.get(); 67 switch (2) 68 { 69 case 'n': 70 case 'N':{ 71 if (++>12) { ++y; m = 1; } 72 d = totald(m, y); showc(d, m, y); 74 75 break; 76 77 { 73 Activate Windows Go to Settings to activate Windows, H: Compiler Resources dlh Compile Log Debug Find Results Line: 346 Col: 44 Sel: 0 Lines: 358 Length: 7571 Insert Done parsing in 1.532 seconds ni PL 1 DEV K da e P9 W C) ENG 2:05 AM 6/10/2020 Q DEV - TDM-GCC 4.9.2 64-bit Release Untitled1 - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help IOHC 88 O 18 JU (globals) Project Classes Debug moga kek gini.cpp calender.h [*] Untitled1 77 78 case 'p': 79 case 'p' : { 80 if (-->m_; 89 cout>y_; 91 m=m_; 92 y=y_j 93 d = totald(m, y); 94 showc(d, m, y); 95 break; 96 97 case 'a': 98 9 case 'A':{ 99 cout>d; 101 cout>m_; 103 cout>y_; 105 cout>id; 132 int ind=-1; 133 for(int i=0;iind && id>=0){ 142 events.erase (events.begin()+ind, events.begin()+ind+1); 143 cout>file; 156 157 ofstream out; 158 159 out.open(file.c_str(); 160 161 if (out. fail() 162 cout>file; 185 186 ifstream in; 187 188 in.open(file.c_str(); 189 190 if(in.fail(){ 191 cout>a; 203 SS>>b; 204 SS>>c; 205 55>>id; 206 getline(in, 1); 207 208 Event event (a,b,c,des, 0); 209 event.setID(id); 210 211 events.push_back(event); 212 213 214 int id=calender.getallEvents().size(); 215 calender.removeEvent(id); 216 217 218 int ind-events.size()-1; 219 events.erase (events.begin()+ind, events.begin()+ind+1); 220 in.close(); 221 222 cout>a; 203 SS>>b; 204 SS>>C; 205 SS>>id; 206 getline(in, 1); 207 208 Event event(a,b,c,des, 0); 209 event.setID(id); 210 211 events.push_back(event); 212 } 213 214 int id=calender.getallEvents().size(); 215 calender.removeEvent(id); 216 217 218 int ind=events.size()-1; 219 events.erase (events.begin()+ind, events.begin()+ind+1); 220 in.close(); 221 222 cout 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 9 10 using namespace std; 11 12 class Event { 13 private: 14 int id; 15 int day; 16 int month; 17 int year; 18 string description; 19 public: 20 Event() { 21 F} 22 Event(int a, int b, int c,string _d, int e) { 23 day = a; 24 month = b; 25 year = c; 26 description - _d; 27 id=b*10000+(a+31+e)*100+(cX100); 28 29 30 void setID(int id_){id=id_;} 31 void setDay(int a) { day = a; } 32 void setMonth(int a) { month = a; } 33 void setYear(int a) { year = a; } 34 35 int getDay() { return day; } 36 int getMonth() { return month; } 37 int getYear() { return year; } 38 int getID){return id;} 39 } Activate Windows Go to Settings to activate Windows, 88 Compiler Resources oh Compile Log Debug Find Results Line: 346 Col: 44 Sel: 0 Lines: 358 Length: 7571 Insert Done parsing in 1.532 seconds e ni PL K da DEV e P9 W C) ENG 2:05 AM 6/10/2020 DEV - TDM-GCC 4.9.2 64-bit Release Untitled1 - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help IOHC HA O EAA JU (globals) Project Classes Debug moga kek gini.cpp calender.h [*] Untitled1 39 40 void setDescription(string s) {description = s;} 41 string getDescription() {return description;} 42 }; 43 44 int totald(int, int); 45 void showc(int, int, int); 46 47 int main() 48 = { 49 50 vector events; 51 int m, y, dy 52 int n, p, C; 53 int d_,_,_; 54 string des; 55 time_t t=time(); 56 struct tm*now=localtime(&t); 57 y=now ->tm_year+1900; 58 n=now->tm_mon+1; 59 d=now->tm_mday; 60 61 d = totald(m, y); 62 showc(d, m, y); 63 char z; 64 do 65 66 z = cin.get(); 67 switch (2) 68 { 69 case 'n': 70 case 'N':{ 71 if (++>12) { ++y; m = 1; } 72 d = totald(m, y); showc(d, m, y); 74 75 break; 76 77 { 73 Activate Windows Go to Settings to activate Windows, H: Compiler Resources dlh Compile Log Debug Find Results Line: 346 Col: 44 Sel: 0 Lines: 358 Length: 7571 Insert Done parsing in 1.532 seconds ni PL 1 DEV K da e P9 W C) ENG 2:05 AM 6/10/2020 Q DEV - TDM-GCC 4.9.2 64-bit Release Untitled1 - Dev-C++ 5.11 File Edit Search View Project Execute Tools AStyle Window Help IOHC 88 O 18 JU (globals) Project Classes Debug moga kek gini.cpp calender.h [*] Untitled1 77 78 case 'p': 79 case 'p' : { 80 if (-->m_; 89 cout>y_; 91 m=m_; 92 y=y_j 93 d = totald(m, y); 94 showc(d, m, y); 95 break; 96 97 case 'a': 98 9 case 'A':{ 99 cout>d; 101 cout>m_; 103 cout>y_; 105 cout>id; 132 int ind=-1; 133 for(int i=0;iind && id>=0){ 142 events.erase (events.begin()+ind, events.begin()+ind+1); 143 cout>file; 156 157 ofstream out; 158 159 out.open(file.c_str(); 160 161 if (out. fail() 162 cout>file; 185 186 ifstream in; 187 188 in.open(file.c_str(); 189 190 if(in.fail(){ 191 cout>a; 203 SS>>b; 204 SS>>c; 205 55>>id; 206 getline(in, 1); 207 208 Event event (a,b,c,des, 0); 209 event.setID(id); 210 211 events.push_back(event); 212 213 214 int id=calender.getallEvents().size(); 215 calender.removeEvent(id); 216 217 218 int ind-events.size()-1; 219 events.erase (events.begin()+ind, events.begin()+ind+1); 220 in.close(); 221 222 cout>a; 203 SS>>b; 204 SS>>C; 205 SS>>id; 206 getline(in, 1); 207 208 Event event(a,b,c,des, 0); 209 event.setID(id); 210 211 events.push_back(event); 212 } 213 214 int id=calender.getallEvents().size(); 215 calender.removeEvent(id); 216 217 218 int ind=events.size()-1; 219 events.erase (events.begin()+ind, events.begin()+ind+1); 220 in.close(); 221 222 cout

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

More Books

Students also viewed these Accounting questions