I have an assignment due today and I'm so rusty at programming and had a week from hell, that i havent even had time to read the new chapter and get started on my lab. I need help asap. here's what i need:
Write a program that contains a class that implements the days of the week. The program should be able to perform the following on an object of the class.
1. Set the day.
2. Print the day.
3. Return the day.
4. Return the next day.
5. Return the previous day.
6. Calculate and return the day by adding a certain amount of days to the current day. For example, if you add five days to Saturday, the day to be returned is Thursday. Likewise, if we add 12 days to Wednesday, the day returned will be Monday.
1. Expand the member functions of iLab 1 to allow for the additional operations outlined in the lab summary above.
2. Call the additional functions, plusOneDay(), minusOneDay(), and addDays().
Function plusOneDay() returns the next day.
Function minusOneDay() returns the previous day.
Function addDays() will take the number of additional days as a parameter and calculate and return a new day name by adding a certain amount of days to the current day.
This is what i have from my previous assignment:
using namespace std;
void setDay(string );
// setDay(string) takes a string parameter
// and stores the value in the day attribute.
void printDay() const;
// printDay() prints the value of the day attribute
// on console output (cout).
string getDay() const;
// returns the value of the day attribute.
string day; // This is where the value of the day attribute is stored.
string DayOfTheWeek::getDay() const
void DayOfTheWeek::setDay(string newDay)
day = newDay;
void DayOfTheWeek::printDay() const
cout << day;
// Set the values of the objects
[url removed, login to view]("Monday");
[url removed, login to view]("Tuesday");
// Get the monday object and print it out
string currentDay = [url removed, login to view]();
cout << "The value of the object is " << currentDay << ". This object wishes it was Sunday!" << endl;
// Print the tuesday object
cout << "The value of the object is ";
[url removed, login to view]();
cout << ". This object is just glad it's not Monday!" << endl;