subject

Instructions write the definitions of the functions to implement the operations defined for the class datetype in programming exercise 6. you may write a main. cpp to test your class datetype. you will only be graded on the contents of the datetype class. this is what i have so far but it is not working: datetype. h#ifndef datetype_h#define datetype_h#include#include#include "datetypeimp. cpp"using namespace std; class datetype{public: void setdate(int x, int y, int z); void setmonth(int x); void setday(int x); void setyear(int x); void print() const; int numberofdayspassed(); int numberofdaysleft(); void incrementdate(int ndays); int getmonth() const; int getday() const; int getyear() const; int getdaysinmonth(); bool isleapyear(); datetype(int=1, int=1, int=1900); //default constructor private: int dmonth; int dday; int dyear; }; #endifdatetypeimp. cpp#include "datetype. h"#includeusing namespace std; datetype: : datetype(int month, int day, int year){setdate(month, day, year); }void datetype: : setdate(int month, int day, int year){setmonth(month); setyear(year); setday(day); }void datetype: : setmonth(int m){if(m > 12 || m < 1){dmonth = 0; cout < < "error: invalid month" < < endl; }else{dmonth = m; }}void datetype: : setyear(int year){dyear = year; }void datetype: : setday(int d){if(dmonth == 2){if(d < 1 || d > 28){if(d == 29 & & (dyear % 4) == 0){dday = d; }else{dday = 0; cout < < "error: invalid date" < < endl; }}else{dday = d; }}else if(dmonth == 4 || dmonth == 6 || dmonth == 9 || dmonth == 11){if(d < 1 || d > 30){dday = 0; cout < < "error: invalid date" < < endl; }else{dday = d; }}else{if(d < 1 || d > 31){dday = 0; cout < < "error: invalid date" < < endl; }else{dday = d; }}}void datetype: : print() const {switch(dmonth){case 1: cout < < "january"; break; case 2: cout < < "february"; break; case 3: cout < < "march"; break; case 4: cout < < "april"; break; case 5: cout < < "may"; break; case 6: cout < < "june"; break; case 7: cout < < "july"; break; case 8: cout < < "august"; break; case 9: cout < < "september"; break; case 10: cout < < "october"; break; case 11: cout < < "november"; break; case 12: cout < < "december"; break; }cout < < " " < < dday < < ", " < < dyear < < endl; }int datetype: : getmonth(){return dmonth; }int datetype: : getday(){return dday; }int datetype: : getyear(){return dyear; }bool datetype: : isleapyear(){return dyear % 4 == 0; }int datetype: : getdaysinmonth(){if(dmonth == 2){if({return 29; }else{return 28; }}else if(dmonth == 4 || dmonth == 6 || dmonth == 9 || dmonth == 11){return 30; }else{return 31; }}void datetype: : incrementdate(int days){while((dday + days) > {days = days - (getdaysinmonth() - dday); if(dmonth == 12){dmonth = 1; dyear++; }else{dmonth++; }dday = 0; }dday += days; }int datetype: : numberofdayspassed(){int tmonth = dmonth; int count = dday; dmonth--; while(dmonth > 0){count += getdaysinmonth(); dmonth--; }dmonth = tmonth; return count; }int datetype: : numberofdaysleft(){int tmonth = dmonth; int count = getdaysinmonth() - dday; dmonth++; while(dmonth < = 12){count += getdaysinmonth(); dmonth++; }dmonth = tmonth; return count; }

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:00
When jen is planning to upgrade to a monitor with a better resolution, what should she be looking for in the new monitor?
Answers: 1
question
Computers and Technology, 22.06.2019 04:40
Amain idea is supported, explained, or expanded on with a numbers b. a concluding statement c. details d. a topic sentence. im e paragraphs reset nex next
Answers: 2
question
Computers and Technology, 22.06.2019 11:30
What do character formats do for your document's message? a.set the tone b.provide organization c.provide clarity d.set how texts align with documents
Answers: 2
question
Computers and Technology, 23.06.2019 03:30
How can you repin an image on your pinterest pin board a. click on the "repin" button b. click on the "add pin" button c. click on the "upload a pin" button d. click on the "save pin" button.
Answers: 2
You know the right answer?
Instructions write the definitions of the functions to implement the operations defined for the clas...
Questions