help please

Write your question here.
my teacher gave us this assignment and refuse to help... the class has to exactly the way it is

Design and implement a class dayType that implements the day of the
week in a program. The class dayType should store the day, such as Sun
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.
Last edited on
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#ifndef h_dayType
#define h_dayType
#include <string>
#include<iostream>
using namespace std;

class dayType 
{
private:
	string weekDay;

public:
	static string weekDays[7];
	void setDay (string d);
	void print() const;
	string getDay () const;
	string nextDay() const;
	string prevDay() const;
	void addDay (int nDays);
		dayType(); 
		dayType(string d);
	/* daytype()
		{ weekDay = "sunday"; }
		dayType( string str)
		{ weekday ( string str; } 
	*/
};
#endif	
int main()
{
	dayType weekDay;
	dayType other;

	cout << " zxc default is: " ; 
	weekDay.print();
	cout << "\n zxc.prevDay is: " << weekDay.prevDay() << endl;
	cout << "zxc.nextday is: " << weekDay.nextDay() << endl;
	cout << " how many days you want to advance : " << endl;
	int d1; cin >> d1;
	weekDay.addDay(d1);

	cout << "what day do you want to start with" << endl;
	string d; cin >> d;
	other.setDay(d);
	cout << " other default is: " ; 
	other.print();
	cout << "\n other.prevDay is: " << other.prevDay() << endl;
	cout << "other.nextday is: " << other.nextDay() << endl;
	cout << " how many days you want to advance : " << endl;
	int d2; cin >> d2;
	other.addDay(d2);
	
	

	
		system("pause");
		return 0;
}

	#include "Days.h"


dayType weekDay = "sunday"; 
dayType str =   " ";
//string str =  "Tuesday"; 

string dayType::weekDays[7]  = {"Sunday ", "Monday", "Tuesday", "Wednesday" , "Thursday" , " Friday" , "Saturday"};

void dayType::setDay (string d) 
	{

	 d = weekDay;

	}

	void dayType::print() const
	{

		cout << weekDay;
	}
	
	string dayType::nextDay() const
	{
		for (int i = 0; i < 7; i++)
		{
		
		 if (weekDay == weekDays[i])
			{
				if (i == 7)
			return weekDays[0];
			 else
				 return weekDays[i+1];
		   }
		}

		

	}
	string dayType::prevDay() const
	{
		
		for (int i = 0; i < 7; i++)
		{
		
		 if (weekDay == weekDays[i])
			{
				if (i == 0)
			return weekDays[6];
			 else
				 return weekDays[i-1];
		   }
		}

		
	}

	void dayType::addDay(int nDays) 
	{
		for (int i = 0; i < 7; i++)
		{
		
		 if (weekDay == weekDays[i])
			{
				
				weekDay = weekDays[i + (nDays % 7)];

		   }
		}

		
		
	 cout << "the new day is : " << weekDay;
	}

	string dayType::getDay () const
	{
return weekDay;
	}
What is the problem that you are facing in this?
@codewalker

i keep getting this error i really dont understand what itt mean


1>------ Build started: Project: hw12fall, Configuration: Debug Win32 ------
1> hw12fall.cpp
1>dayIMP.obj : error LNK2019: unresolved external symbol "public: __thiscall dayType::dayType(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0dayType@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "void __cdecl `dynamic initializer for 'weekDay''(void)" (??__EweekDay@@YAXXZ)
1>hw12fall.obj : error LNK2001: unresolved external symbol "public: __thiscall dayType::dayType(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0dayType@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>hw12fall.obj : error LNK2019: unresolved external symbol "public: __thiscall dayType::dayType(void)" (??0dayType@@QAE@XZ) referenced in function _main
1>C:\Users\Mike\documents\visual studio 2010\Projects\hw12fall\Debug\hw12fall.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Last edited on
You define two constructors in you class declaration (line 20,21), however, you have no implementation for then. The linker is telling you they don't exist.
@abstractinanon

Thanx but how do you go about implementing them, that's what I don't understand
Implement like you would anything else:

1
2
3
4
//Constructors
//Finish up
dayType::dayType(){}
dayType::dayType(string d){/*Code Here*/}
Topic archived. No new replies allowed.