Can you please explain to how this project has to be done? I'm a little bit lost, I think I should do everything in my .h file
Write your class and member functions.
1.Implement a code that allows to access your object with extraction operator >> and insertion operator >>
2. Implement 1 day after feature by using operator overloading.
3. Find a creative way to calculate and display the integer representing a day.
4. Your client program needs to get the input for a user and demonstrate your class, display the integer representing a day, and overloaded operators designed in the step 4 and 5. See example output below. The user enters values in bold.
This program converts a month and day of month into a day of the year in the range 1..365
Enter month and day (Example: January 3): March 1
Number of days from January 1 to your selected date: 60
The next day is March 2 .
Here is what I have in my .h file so far, am I on the right track?
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
|
#include <string>
#include <iostream>
using namespace std;
#ifndef Date-H
#define Date_H
class Date
{
int day;
string month;
public:
Date(){ day;}
//prefix
Date operator++(){
++day;
return *this;
}
void displayDay(){ cout << day << endl; }
~Date();
//Accessor Functions.
int getDay();
string getMonth();
private:
//Member variables.
int newDay;
string newMonth;
};
#endif
|