Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the files day.h and question2.cpp. The header provides the complete declaration for the Day class. Without modifying the declaration, complete the methods of the

Given the files day.h and question2.cpp. The header provides the complete declaration for the Day class. Without modifying the declaration, complete the methods of the class and use Question1.cpp to verify your implementation. The output should match the example below.

day.h file:

#include

using namespace std;

class Day {

public:

Day();

Day(string day);

void setDay(string day);

string getDay();

void addDays(int numDays);

string nextDay();

string prevDay();

private:

int getIdx(string day);

string getStr(int idx);

string _day;

};

question2.cpp:

#include

#include"Day.h"

using namespace std;

int main(void) {

Day dflt, thu("THU");

cout << "Default Constructor: " << dflt.getDay() << endl;

cout << "Thursday Constructor: " << thu.getDay() << endl;

thu.addDays(5);

cout << "Added 5 days to Thursday: " << thu.getDay() << endl;

cout << "Tomorrow is: " << thu.nextDay() << endl;

cout << "Yesterday was: " << thu.prevDay() << endl;

}

output Example:

Default Constructor: SUN

Thursday Constructor: THU

Added 5 days to Thursday: TUE

Tomorrow is: WED

Yesterday was: MON

Press any key to continue . . .

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+C CA do not imply that A = RT.

Answered: 1 week ago

Question

4. Choose appropriate and powerful language

Answered: 1 week ago

Question

2. Choose an appropriate organizational pattern for your speech

Answered: 1 week ago