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, 21.06.2019 22:50
Explain why it is reasonable to assume that receiving 3 duplicate acks in tcp is an indication that the network is not currently congested.
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
One of your customers wants you to build a personal server that he can use in his home. one of his concerns is making sure he has at least one backup of their data stored on the server in the event that a disk fails. you have decided to back up his data using raid. since this server is for personal use only, the customer wants to keep costs down. therefore, he would like to keep the number of drives to a minimum. which of the following raid systems would best meet the customer's specifications? a. raid 0 b. raid 1 c. raid 5 d. raid 10
Answers: 3
question
Computers and Technology, 23.06.2019 07:30
What key should you press and hold to select and open multiple files at one time? enter alt control esc
Answers: 1
question
Computers and Technology, 23.06.2019 22:00
Jackson, who works in the finance department of a company, is holding a seminar for other employees on how to file taxes. only three employees sign up to attend the seminar. which device can he use to share his presentation with a group of three employees?
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, 25.02.2021 22:20
question
Mathematics, 25.02.2021 22:20
Questions on the website: 13722363