Lawlzes

Ch7_1.cpp Instructions

Oct 29th, 2014
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. home / homework help / questions and answers / engineering / computer science / design a class called date that has integer data ...
  2. You have 58 hours remaining to receive answers.
  3. Got the help you need? Select it as Best Answer to thank the community.
  4.  
  5.  
  6. Question in Computer Science Anonymous asked on October 28, 2014
  7. 1,500 points
  8. 9h 58m left to answer Edit question Edit points or time
  9. Design a class called Date that has integer data members to store month, day, and year. The class should have a three-parameter default constructor that allows the date to be set at the time a new Date object is created. If the user creates a Date object without passing any arguments, or if any of the values passed are invalid, the default values of 1, 1, 2001 (i.e., January 1, 2001) should be used. The class should have member functions to print the date in the following formats:
  10.  
  11. 3/15/13
  12.  
  13. March 15, 2013
  14.  
  15. 15 March 2013
  16.  
  17. Demonstrate the class by writing a program that uses it. Be sure your program only accepts reasonable values for month and day. The month should be between 1 and 12. The day should be between 1 and the number of days in the selected month.
  18.  
  19. (MUST CREATE Date.h and Date.cpp).
  20.  
  21. == ABSOLUTELY NO GLOBAL VARIABLES ALLOWED == (constants are fine as global)
  22.  
  23. #include
  24. #include "Date.h"
  25. using namespace std;
  26.  
  27. int main()
  28. {
  29. // declare variables for month, day, year
  30.  
  31. // collect and validate month
  32.  
  33. // collect and validate day based on the month
  34.  
  35. // collect and validate year
  36.  
  37. // declare the Date object using the month, day, and year
  38.  
  39. // call the first display member function: for example myDate.showShortDate();
  40.  
  41. // call the second display member function: for example myDate.showLongDate();
  42.  
  43. // call the third display member function: for example myDate.showEuroDate();
  44.  
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment