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.
Here is my debugging errors:
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
string my_Day[7] = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
class dayType
{
public:
void setDay();
void printDay() const;
void getDay();
void incrementDay();
dayType();
private:
int myDay;
int day;
};
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;
}
|