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

form day/month/year. Do not modify the main program. You must write the prototyp

ID: 3542537 • Letter: F

Question

                    form day/month/year. Do not modify the main program.                 

                    You must write the prototypes and the denitions of the methods of the class. Keep the                 

                    following rules in mind:                 

                    Rule regarding pass by reference:                 

                    When deciding how to pass function arguments:                 

                    if the argument must be changed by the function {                 

                    pass by reference                 

                    }                 

                    else if the argument is an object {                 

                    pass by reference but declare the object to be const                 

                    }                 

                    else{                 

                    pass by value                 

                    }                 

                    Rule regarding const methods:                 

                    If a method does not change the object then the keyword const is placed after the function.                 

                    /* File: date.cpp                 

                    A class representing dates in the form: day, month and year                 

                    dates are written to a stream in the form day/month/year                 

                    Assignment 2 6                 

                    day_number() returns the number of days since 1/1 of the current year                 

                    including the current day                 

                    #include <iostream>                 

                    #include <fstream>                 

                    using namespace std;                 

                    class date {                 

                    private:                 

                    int day;                 

                    int month;                 

                    int year;                 

                    public:                 

                    // you fill in the method prototypes                 

                    };                 

                    // number of days in each month                 

                    const int DAYS[12] = {31,28,31,30,31,30,31,31,30,31,30,31};                 

                    int main(void)                 

                    {                 

                    ofstream fout("date.out");                 

                    date d(12, 6, 2010);                 

                    date e(19, 9, 2013);                 

                    fout << "For the date is ";                 

                    d.write(fout);                 

                    fout << endl;                 

                    fout << "Day number is " << d.day_number() << endl;                 

                    fout << " For the date is ";                 

                    e.write(fout);                 

                    fout << endl;                 

                    fout << "Day number is " << e.day_number() << endl;                 

                    return 0;                 

                    }                 

                    ///////////////////////// Methods of date ////////////////////////////                 

                    /////////////////////////////////////////////////////////////////////////////                 

                    Your program output should be:                 

                    For the date is 12/6/2010                 

                    Day number is 163                 

                    For the date is 19/9/2013                 

                    Day number is 262

Explanation / Answer