I am not asking for answers, just a little guidance as to why I am receiving the errors that I'm getting after debugging. I need help with my homework assignment. My code is written below. Here is the assignment from the text book:
Write the definition of the class dayType that implements the day of the week in a program. The class dayType should store the day, such as Sunday for Sunday. The program should be able to perform the following operations on an object of type dayType:
a. Set the day
b. Print the day
c. Return the day
d. Return the next day
e. Return the previous day
f. Calculate and return the day by adding certain days to the current day. For example, if the current day is Monday and we add 4 days, the day to be returned is Friday. Similarly, if today is Tuesday and we add 13 days, the day to be returned is Monday.
g. Add the appropriate constructors
Write the definitions of the functions to implement the operations for the class dayType.
void dayType::setDay(int day)
{
if (0 <= day && day < 8)
myDay = day;
else
myDay = 0;
}
void dayType::incrementDay()
{
day++;
}
void dayType::getDay(int day) const
{
day = myDay;
}
void dayType::printDay() const
{
}
int main ()
{
return 0;
}
And here are the error messages that I get:
Line 23 error: prototype for 'void dayType::setDay(int)' does not match any in class 'dayType'
Line 11 error: candidate is: void dayType::setDay()
Line 36 error: prototype for 'void dayType::getDay(int) const' does not match any in class 'dayType'
Line 13 error: candidate is: void dayType::getDay()
I know this is probably a really easy mistake but I am new to Programming and I have changed this code for days to no avail. Any help would be greatly appreciated. Thanks in advance.
a) its because when setDay is declared in your class it takes no args but its definition does. same with get day, but that should return an int, not set one