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:30
Write a program that takes in 3 inputs [players (int type), expected game time (double type), team (char type)] and calculates actual game time (double) based on the following conditions: if the number of players or the expected game time is less than or equal to zero, it should output wrong input if the number of players is greater than 0 and less than or equal to 6 and if they are on the â€r’ or â€r’ team, their game time will be 10% faster. and if they are on the â€b’ or â€b’ team, their game time will be 15% faster. and if they are on the â€y’ or â€y’ team, their game time will be 20% faster. and if they are on any other team, they will play 0% faster. if the number of players is greater than 6 but less than or equal to 12 and if they are on the â€r’ or â€r’ team, their game time will be 20% faster. and if they are on the â€b’ or â€b’ team, their game time will be 25% faster. and if they are on the â€y’ or â€y’ team their game time will be 30% faster. and if they are on any other team, they will play 0% faster. if the number of players is greater than 12 but less than or equal to 18 and if they are on the â€r’ or â€r’ team, their game time will be 30% faster. and if they are on the â€b’ or â€b’ team, their game time will be 35% faster. and if they are on the â€y’ or â€y’ team, their game time will
Answers: 2
question
Computers and Technology, 22.06.2019 14:20
Cengagenowv2 is a comprehensive online learning tool. using cengagenowv2, you may access all of the following except: 2. each time you log in, cengagenowv2 automatically performs a system check and informs you if your computer does not meet the cengagenowv2 system requirements. 3. which tab/page allows you to easily track your assignment scores, number of submissions, time spent, as well as the ability view assign
Answers: 3
question
Computers and Technology, 22.06.2019 19:00
The fourth generation of computers emerged between 1970s and 1980s. which technological advancement brought about this generation of computers? which computer architecture was used most in this generation?
Answers: 3
question
Computers and Technology, 23.06.2019 18:30
This program should be a short piece of code that prints all of the positive integers from 1 to 100 as described more fully below. the program may contain multiple methods, and if using an oo language, should be contained within a single class or object. the program should be designed so that it begins execution when invoked through whichever mechanism is most common for the implementation language. â–ş print out all positive integers from 1 to 100, inclusive and in order. â–ş print messages to standard output, matching the sample output below. â–ş in the output, state whether the each integer is 'odd' or 'even' in the output. â–ş if the number is divisible by three, instead of stating that the number is odd or even, state that the number is 'divisible by three'. â–ş if the number is divisible by both two and three, instead of saying that the number is odd, even or divisible by three; state that the number is 'divisible by two and three'. â–ş design the logic of the loop to be as efficient as possible, using the minimal number of operations to perform the required logic. sample output the number '1' is odd. the number '2' is even. the number '3' is divisible by three. the number '6' is divisible by two and three.
Answers: 1
You know the right answer?
Instructions write the definitions of the functions to implement the operations defined for the clas...
Questions
question
Mathematics, 22.09.2019 17:30
question
Social Studies, 22.09.2019 17:30
question
Mathematics, 22.09.2019 17:50
question
Mathematics, 22.09.2019 17:50
question
Social Studies, 22.09.2019 17:50
Questions on the website: 13722361