Advertisement
Guest User

date.h

a guest
Sep 25th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.50 KB | None | 0 0
  1. #ifndef date_H
  2. #define date_H
  3.  
  4. //************************************************************
  5. //
  6. // class dateType
  7. // This class specifies the members to implement a date.
  8. //************************************************************
  9.  
  10. class dateType
  11. {
  12. public:
  13.     void setDate(int month, int day, int year);
  14.     //Function to set the date.
  15.     //The member variables dMonth, dDay, and dYear are set
  16.     //according to the parameters.
  17.     //Postcondition: dMonth = month; dDay = day; dYear = year
  18.  
  19.     int getDay() const;
  20.     //Function to return the day.
  21.     //Postcondition: The value of dDay is returned.
  22.  
  23.     int getMonth() const;
  24.     //Function to return the month.  
  25.     //Postcondition: The value of dMonth is returned.
  26.  
  27.     int getYear() const;
  28.     //Function to return the year.    
  29.     //Postcondition: The value of dYear is returned.
  30.  
  31.     void printDate() const;
  32.     //Function to output the date in the form mm-dd-yyyy.
  33.  
  34.     dateType(int month = 1, int day = 1, int year = 1990);
  35.     //Constructor to set the date
  36.     //The member variables dMonth, dDay, and dYear are set
  37.     //according to the parameters.
  38.     //Postcondition: dMonth = month; dDay = day; dYear = year. If
  39.     //    no values are specified, the default values are used to
  40.     //    initialize the member variables.
  41.  
  42.     bool isLeapYear(int month, int day, int year);
  43.     // returns true if a year is a leap year or false if not
  44.  
  45.  
  46. private:
  47.     int dMonth; //variable to store the month
  48.     int dDay;   //variable to store the day
  49.     int dYear;  //variable to store the year
  50. };
  51.  
  52.  
  53.  
  54. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement