Guest User

Untitled

a guest
Dec 7th, 2019
101
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include "Date.h"
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int test_version = 0;
  8. cout << "Enter the test version: ";
  9. cin >> test_version;
  10.  
  11. if (test_version == 1) // test create default date and print it three ways
  12. {
  13. cout << "\nTest1: default date, printed in three formats:\n\t";
  14. Date day;
  15. day.print(1);
  16. cout << "\t";
  17. day.print(2);
  18. cout << "\t";
  19. day.print(3);
  20. cout << endl;
  21. }
  22.  
  23. if (test_version == 2) // test create Christmas and print it three ways
  24. {
  25. cout << "\nTest2: Christmas 2019, printed in three formats:\n\t";
  26. Date day (12, 25, 2019);
  27. day.print(1);
  28. cout << "\t";
  29. day.print(2);
  30. cout << "\t";
  31. day.print(3);
  32. cout << endl;
  33. }
  34.  
  35. if (test_version == 3) // create Christmas and extract info via get member functions
  36. {
  37. cout << "\nTest3: Christmas 2019, printed and day, month, year extracted with get member functions\n";
  38. Date day (12, 25, 2019);
  39. day.print(1);
  40. cout << endl;
  41.  
  42. int month = day.getMonth();
  43. int dy = day.getDay();
  44. int year = day.getYear();
  45. cout << "The returned values are Month: " << day.getMonth() << "\tDay: " << day.getDay() << "\tYear: " << day.getYear() << endl;
  46.  
  47. }
  48.  
  49. if (test_version == 4) // create Christmas and set the date to Valentine's day next year
  50. {
  51. cout << "\nTest4: Christmas 2019, printed:\n\t\nThen make Valentine's day with set member functions\n";
  52. Date day (12, 25, 2019);
  53. day.print(1);
  54. cout << endl;
  55.  
  56. if (day.setYear(2020))
  57. cout << "Year set without error ";
  58. else
  59. cout << "Year set WITH error ";
  60.  
  61. if (day.setMonth(2))
  62. cout << "Month set without error ";
  63. else
  64. cout << "Month set WITH error ";
  65.  
  66. if (day.setDay(144))
  67. cout << "Day set without error ";
  68. else
  69. cout << "Day set WITH error ";
  70.  
  71. cout << "\n\tValentines day is: ";
  72. day.print(1);
  73. cout << endl;
  74. }
  75.  
  76. return 0;
  77. }
RAW Paste Data