Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design and implement a class dayType that implements the day of the week in a pr

ID: 3568378 • Letter: D

Question

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.

write the definitions of the functions to implement the operations for the class dayType as defined in Programming above. Also, write a program to test various operations on this class.

THis is the error i get source.cpp(26): fatal error C1083: Cannot open include file: 'dayType.h': No such file or directory. Please help

#include<iostream>
#include<string>
using namespace std;

class dayType
{
public:
dayType();

string day[8];
int dayNumber;
int tempDay;

void setDay(int day);
void printDay();
void returnDay(int &day);
void returnNextDay();
void returnPreviousDay();
void calculateDay(int changeDay);
};

//Implementation file
  
#include <iostream>
#include <string>
#include "dayType.h"

using namespace std;

void dayType::printDay()
{
cout << "Today is: " << day[dayNumber] << "day" << endl;};

void dayType::setDay(int day)
{
dayNumber=day;};

void dayType::returnDay(int &day)
{
day=dayNumber;};
  
void dayType::returnNextDay()
{
dayNumber++;};

void dayType::returnPreviousDay()
{
dayNumber--;};

void dayType::calculateDay(int changeDay)
{
tempDay=(dayNumber+changeDay);
dayNumber=(tempDay%7);};
  
//Main file

#include <iostream>
#include "dayType.h"

using namespace std;

int main()
{
dayType today;

int day;
int changeDay;

cout << "------------------------------------------------------------------" << endl;
cout << "Default day is Sunday " << endl;
cout << "Type in a number corresponding to set the day" << endl
<< "1: Monday" << endl
<< "2: Tuesday" << endl
<< "3: Wednesday" << endl
<< "4: Thursday" << endl
<< "5: Friday" << endl
<< "6: Saturday" << endl
<< "7: Sunday" << endl;

while (day<0 || day>7)
cin >> day;

today.setDay(day);
today.printDay();

today.returnDay(day);
today.printDay();
  
cout << "-----------------------------------------------------------------" << endl;
cout << "If it were tomorrow, then the following statement would be true: " << endl;
today.returnNextDay();
today.printDay();
today.dayNumber--;
100   cout << "-----------------------------------------------------------------" << endl;
cout << "If it were yesterday, then the following statement would be true:" << endl;
today.returnPreviousDay();
today.printDay();
today.dayNumber++;
cout << "-----------------------------------------------------------------" << endl;
cout << "Add a number of days to today and see what day it will be: " << endl;
cin >> changeDay;
today.calculateDay(changeDay);
today.printDay();
  
return 0;
};

dayType::dayType()
{
dayNumber=1;
day[1]="Mon";
day[2]="Tues";
day[3]="Wednes";
day[4]="Thurs";
day[5]="Fri";
day[6]="Satur";
day[7]="Sun";
};

Explanation / Answer

As the error says you have missing file "dayType.h" in your diretory.

make sure you have this file in your directory

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote