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 23:20
How can you tell if someone sent you a text message to your email instead of a email
Answers: 1
question
Computers and Technology, 23.06.2019 04:00
In a word processing program, such as microsoft word, which feature to you choose the desired picture enhancement?
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
1. which of the following statements are true about routers and routing on the internet. choose two answers. a. protocols ensure that a single path between two computers is established before sending packets over it. b. routers are hierarchical and the "root" router is responsible for communicating to sub-routers the best paths for them to route internet traffic. c. a packet traveling between two computers on the internet may be rerouted many times along the way or even lost or "dropped". d. routers act independently and route packets as they see fit.
Answers: 2
question
Computers and Technology, 24.06.2019 16:00
What is a dashed line showing where a worksheet will be divided between pages when it prints? a freeze pane a split box a page break a print title
Answers: 1
You know the right answer?
Instructions write the definitions of the functions to implement the operations defined for the clas...
Questions
question
History, 18.05.2021 20:10
question
Mathematics, 18.05.2021 20:10
question
Mathematics, 18.05.2021 20:10
question
Mathematics, 18.05.2021 20:10
question
Arts, 18.05.2021 20:10
question
Mathematics, 18.05.2021 20:10
Questions on the website: 13722362