CALMAIN FILE
DATEMAIN FILE
DAYMAIN FILE
CS 202 - Assignment #3 Purpose: Points: Learn class inheritance, multi-file class implementation and make utility. | 100 Assignment: Design and implement three C-- classes to provide a series of calendar date support functions., dayType, dateType, and calendar Type. Each of the classes is described below. CALENDARIO MEANINGFUL DATES EACHDESSZEREPES OFTEN ITS REFERRED BY ME EsOCIBER ) NENGUSH-UNGAGE BOOKS SINCE 2000 dayType Implement a basic dayType class to provide basic date functions. The day Type UML class diagram is as follows: 4 JANUARY FEBRUARY Moo 1234561 17 HKCH17 290u 557a921456789 02281557 E2311567 1 In msgD ht N685 talgi 5 =ng * AE278 29S MS 11gBan10 Tag H5 MA ma bBR 2 18 Telnmph bt36885 K5 SH6 wbSA Hn _MA.25kg 1a 796B8A les Tag 1868 5 &qn 25 b H7r 195 Q68B dayType #month: int *date: int #year: int -zzy-Trairc='...-1, nr=1271] +printDate() const: void +getDate() const: int +getMonth() const: int +getYear( const: int +3etDate(int, int, int) : void +readDate(): void +nextDay(): void +nextDay (int) : void +prevDay(): void +prevDay (int) : void #isleapYear (int) const: bool #daysInMonth (int, int) const: int SEPTEMBER 1 235673 35: 59 br8 ba 92017 235 33 2829 9 99 Source: http://xkcd.com/1140 Function Descriptions The following are more detailed descriptions of the required functions. The constructor dayType(int,int,int) function should set the date to the passed values (month, date, year in that order). The passed values must be checked for valid dates, including the date for the given month and year. The year must be between 1800 and 3050 (inclusive). If any date value is incorrect, the date should be set to the default. 1/1/1970 date. The printDate() function should print the date in the mm/dd/yyyy format. Refer to the example executions for formatting The get Month().getDate(), and getYear() functions return the current values for each. The nextDay and prevDay() functions increment or decrement the current class date one day, changing month and or year if necessary. The nextDay(int) and prevDay(int) functions increment or decrement the current class date by the number of days passed (changing month and/or year if necessary). The setDate/month, date, year) function should set the date based on the passed values. The passed values must be checked for valid dates, including the date for the given month and year. The year must be between 1800 and 3050 (inclusive). If any date value is incorrect, the date should be set to the default, 1/1/1970 date. The readDate/ function should read the date form the console in the mm/dd/yyyy format and include appropriate error checking. The year must be between 1800 and 3050 (inclusive). The function should re-prompt until a value date is provided. Refer to the example executions for formatting. The isLeap Year(year) function returns true if the given year is a leap year and false otherwise. The daysInMonth(mon, year) function returns the number of days in the given month and year. Use the provided main, day Main.cpp, to demonstrate that the day Type class functions correctly The main and provided makefile reference files dayTypeImp.cpp and dayType.h. Your implementation and header files should be fully commented. dateType Class The dateType class will provide the dayType functionality with some additional functionality. Specifically, the dateType class will add support for the month names ('January', 'February', etc.) and day names ('Sunday', 'Monday', etc.). Since the dateClass will extend the basic dayType functionality, dateClass will be derived form the dayClass. The date Type UML class diagram is as follows: dateType #monthName: string #dayName: string +dateType() +dateType (int, int, int) +print FormattedDate() const: void +get MonthName() const: string +get DayName() const: string +nextDay(): void +next Day (int) : void +prevDay(): void +prevDay (int) : void +3etDate (int, int, int) : void +readDate(): void #setDateStrings(): void #getDayNumber(int, int, int) const: int Function Descriptions The following are more detailed descriptions of the required functions. The default dateType/ constructor should set the date to the current date (from the OS) and then set the date strings accordingly. The dateType/month date year) constructor should use the base class constructor but also set the date strings. Note, this means invalid dates will be set to 1/1/1970. The printFormattedDatefunction should print the date in the
, , format. For example, 1/1/1970 would be: Thursday, January 1, 1970. The serDateStrings() function should set the monthName and dayName class variables with the appropriate strings based on the current integer date values. As such, any time the date is altered, the strings must be updated. The getDay Number month date, year) function return the day number 0-6 (0 for a Sunday, 1 for a Monday, 2 for a Tuesday, etc.) for either the current passed date. Refer to the provided formula. The serDate/month, date year) function should set the date to the passed values and set the date strings. If any part of the passed date is invalid, the entire date should be set to the current date (from the OS). The nextDayO and prevDay functions should use the base class functions to increment or decrement the current class date (maintained in the base class) one day. The functions must also set the date strings (via the setDateStrings() function). The nextDay(int) and prevDay (int) functions should use the base class functions to increment or decrement the current class date (maintained in the base class) by the number of days passed (changing month and/or year if necessary). The functions must also set the date strings (via the setDateStrings() function). The ger MonthName) and getDayName() functions return the strings from the corresponding class variables. The roadDate() function should use the base class function to read the date. Then, the function must also set the date strings. Use the provided main, date. Main.cpp, to demonstrate that the dateType class functions correctly. The main and provided makefile reference files date Type imp.cpp and date 7ype.h. Your implementation and header files should be fully commented calendar Type Class The calendar Type class will provide the dateType functionality (which includes the day Type functionality) with some additional functionality. Specifically, the calendar class will add support for printing a month box and an calendar for all twelve months. Since the calendar Class will extend the basic day Type functionality, dateClass will be derived form the da Class. The calendar Type UML class diagram is as follows: calendar Type +calendar Type() +calendar Type (int, int, int +printMonthBox() const: void #printYearBox() const: void Obtaining Current Date The following system calls will obtain the current date. time turl: tm local: time (&currl); local=* (localtime (currl)); // get Current time_t value // dereference and assign month = local.tm_mon + 1; date = local.ta_aday: year = local.tm year + 1900; Note, requires: #include Testing A script file to execute the program on a series of predefined inputs is provided. Please follow the I/O examples. The test utility should be downloaded into the working directory. The script file will require execute privilege (i.e., chmod +x tst3). The test script, named tst3, here can be executed on each of the various mains (dayMain, dateMain, or calMain) as follows: ed&vme ./tst3 dayMain ed@vme ./tst3 dateMain ed&vm ./tst3 calMain The test script compares the program output to predefined expected output (based on the example 10), Note, the ed@vme is the prompt on my machine. Example Execution: Below is an example program execution. You should ensure the program works for various dates and that moving the date forward and backwards correctly reflects the appropriate calendar dates. You can refer to (http://www.timeanddate.com/calendar/) to check dates. Below is an example output for the day Main program ed-vmt ./dayMain Federal Holidays for 2020: Date: 1/1/2020 Date: 1/20/2020 Date: 2/17/2020 Date: 5/25/2020 Date: 7/3/2020 Date: 9/7/2020 Date: 10/12/2020 Date: 11/11/2020 Date: 11/26/2020 Date: 12/25/2020 Today was: Date: 1/1/1970 Today is: Date: 1/31/2020 Tomorrow is: Date: 2/1/2020 Yesterday was: Date: 1/30/2020 Use the provided main, cal Main.cpp, to demonstrate that the calendar Type functions correctly. The main and provided makefile reference files calendar TypeImp.cpp and calendar Type.h. Your implementation and header files should be fully commented. Each class must be fully completed prior to moving on to the next. Refer to the example executions for output formatting. Make sure your program includes the appropriate documentation. See Program Evaluation Criteria for CS 202 for additional information Make File: The provided make file assumes the source file names are as described above. If you change the names, the make file will need to be edited accordingly. To build the day Type class, dateType class, or calendar Type class provided mains; make day Main make dateMain make calmain Which will create the day Main (for dayType class), date Main (for dateType class), and calMain (for calendar Type class) executables respectively. Submission: Submit a compressed zip file of the program source files, header files, and makefile via the on- line submission All necessary files must be included in the ZIP file. The grader will download, uncompress, and type make (so you must have a valid, working makefile). Day of Week Formula: To calculate the day on which a particular date falls, the following algorithm may be used (the divisions are integer divisions): = 14 - month 12 y = year - a m = month + 12 2 - 2 1 = [ date + y + *- lo + 4 0 + 34 m) mod 7 The value of d is 0 for a Sunday, 1 for a Monday, 2 for a Tuesday, etc. Leap Year A year is a leap year if it is evenly divisible by 4, but not evenly divisible by 100. However, if the year is evenly divisible by 400, it is a leap year. Obtaining Current Date The following system calls will obtain the current date. time turl: tm local: time (&currl); local=* (localtime (currl)); // get Current time_t value // dereference and assign month = local.tm_mon + 1; date = local.ta_aday: year = local.tm year + 1900; Note, requires: #include Testing A script file to execute the program on a series of predefined inputs is provided. Please follow the I/O examples. The test utility should be downloaded into the working directory. The script file will require execute privilege (i.e., chmod +x tst3). The test script, named tst3, here can be executed on each of the various mains (dayMain, dateMain, or calMain) as follows: ed&vme ./tst3 dayMain ed@vme ./tst3 dateMain ed&vm ./tst3 calMain The test script compares the program output to predefined expected output (based on the example 10), Note, the ed@vme is the prompt on my machine. Example Execution: Below is an example program execution. You should ensure the program works for various dates and that moving the date forward and backwards correctly reflects the appropriate calendar dates. You can refer to (http://www.timeanddate.com/calendar/) to check dates. Below is an example output for the day Main program ed-vmt ./dayMain Federal Holidays for 2020: Date: 1/1/2020 Date: 1/20/2020 Date: 2/17/2020 Date: 5/25/2020 Date: 7/3/2020 Date: 9/7/2020 Date: 10/12/2020 Date: 11/11/2020 Date: 11/26/2020 Date: 12/25/2020 Today was: Date: 1/1/1970 Today is: Date: 1/31/2020 Tomorrow is: Date: 2/1/2020 Yesterday was: Date: 1/30/2020 Due Date is: Date: 2/19/2020 Constructor and setDate error testing Date: 1/1/1970 Date: 1/1/1970 Date: 1/1/1970 Date: 2/29/2020 Date: 1/1/1970 Date: 1/1/1970 Date: 1/1/1970 Date: 1/1/1970 Date: 1/1/1970 Date: 1/1/1970 Date: 1/1/1970 When is new years day? Enter date (mm/dd/year): 1/35/2020 Invalid date, please re-enter. Enter date (mm/dd/year): 1/0/2020 Invalid date, please re-enter. Enter date (mm/dd/year): 1/1/2020 News Year Day: Date: 1/1/2020 News Year Eve: Date: 12/31/2019 Next Month: Date: 2/2/2020 Last Quarter Month: Date: 10/3/2019 Mid Year: Date: 7/1/2020 When is your birthday? Enter date (mm/dd/year): 6/31/2001 Invalid date, please re-enter. Enter date (mm/dd/year): 6/30/2001 Your lucky number is 6 + 30 + 2001 - 2037 ed-vme Below is an example program execution for the date. Main program. ed-vme ./dateMain Federal Holidays for 2020: Date: Wednesday, January 1, 2020 Date: Monday, January 20, 2020 Date: Monday, February 17, 2020 Date: Monday, May 25, 2020 Date: Friday, July 3, 2020 Date: Monday, September 7, 2020 Date: Monday, October 12, 2020 Date: Wednesday, November 11, 2020 Date: Thursday, November 26, 2020 Date: Friday, December 25, 2020 Today is: Date: Friday, January 24, 2020 Due Date is: Date: Wednesday, February 19, 2020 Tomorrow is: Date: 1/25/2020 Yesterday was: Date: 1/23/2020 When is new years day? Enter date (mm/dd/year): 1/90/2020 Invalid date, please re-enter. Enter date (mm/dd/year): 1/1/2020 News Year Day: Date: Wednesday, January 1, 2020 News Year Eve: Date: Tuesday, December 31, 2019 Next Month: Date: Sunday, February 2, 2020 Last Quarter Month: Date: Thursday, October 3, 2019 Mid Year: Date: Wednesday, July 1, 2020 When is your birthday? Enter date (mm/dd/year): 2/30/2000 Invalid date, please re-enter. Enter date (mm/dd/year): 2/29/2000 Your birthday Date: Tuesday, February 29, 2000 Yeah, Tuesday's are lucky! Your lucky number is 2 + 29 - 2000 - 2031 ed-vme ed-vme Below is an example program execution for the calMain program. ed-vme /calMain Federal Holidays for 2020: Date: Wednesday, January 1, 2020 Date: Monday, January 20, 2020 Date: Monday, February 17, 2020 Date: Monday, May 25, 2020 Date: Friday, July 3, 2020 Date: Monday, September 7, 2020 Date: Monday, October 12, 2020 Date: Wednesday, November 11, 2020 Date: Thursday, November 26, 2020 Date: Friday, December 25, 2020 Today is: Date: Friday, January 24, 2020 Due Date is: Date: Wednesday, February 19, 2020 Tomorrow is: Date: Saturday, January 25, 2020 Yesterday was: Date: 1/23/2020 When is new years day? Enter date (mm/dd/year): 1/32/2020 Invalid date, please re-enter. Enter date (mm/dd/year): 1/1/2020 News Year Day: Date: Wednesday, January 1, 2020 News Year Eve: Date: Tuesday, December 31, 2019 Next Month: Date: Sunday, February 2, 2020 Last Quarter Month: Date: Thursday, October 3, 2019 Mid Year: Date: Wednesday, July 1, 2020 Month Box | July 20201 | Su Mo Tu We Th Fr Sa 1 11213141 15 16 17 18 19 | 10 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 24 25 26 27 28 29 30 31 1 When is your birthday? Enter date (mm/dd/year): 2/29/2001 Invalid date, please re-enter. Enter date (mm/dd/year): 2/28/2001 Yeah, Wednesday are lucky! Your lucky number is 2 - 28 - 2001 - 2031 Birthday Month Box February 2001 | Su Mo Tu We Th Fr Sa 1 112131 14 15 16 17 18 19 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 Non Leap Year Month Box | February 20201 Su Mo Tu We Th Fr Sa 1 121314151617181 1 9 | 10 | 11 | 12 | 13 | 14 | 15 | | 16 | 17 | 18 | 19 | 20 | 21 | 22 | I 23 24 | 25 | 26 | 27 | 28 | 29 I Leap Year Month Box | February 20201 Su Mo Tu We Th Fr Sa ! 1 1 1 1 | 2 | 3 | 4 | 5 | 6 | 7 | 81 9 | 10 | 11 | 12 | 13 | 14 | 15 | | 16 | 17 | 18 | 19 | 20 | 21 | 22 | | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Leap Year Month Box July 2020 | Su Mo Tu We Th Fr Sa ! 111213141 15 16 17 18 19 | 10 | 11 | | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 20 21 22 23 24 25 I 26 27 28 29 30 31 Year Box Test | January 20011 February 2001 1 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 1 11 21 31 41 51 61 1 11 21 31 17 18 19 | 10 | 11 | 12 | 13 | 14 | 5 | 6 | 7 | 8 | 9 | 10 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 28 | 29 | 30 | 31 1 | 25 | 26 | 27 | 28 I March 2001 April 2001 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 112131 14 15 16 17 18 19 | 10 111213141516171 | 11 | 12 | 13 | 14 | 15 | 16 | 17 1 8 19 | 10 | 11 | 12 | 13 | 14 | | 18 | 19 | 20 | 21 | 22 | 23 | 24 15 | 16 | 17 | 18 | 19 | 20 | 21 | I 25 | 26 | 27 | 28 29 | 30 | 31 | 22 | 23 | 24 | 25 26 27 | 28 1 29 130 May 2001 June 2001 I Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 1 1121314151 11 21 16 17 18 19 | 10 | 11 | 12 13 14 15 16 17 18 19 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 31 1 | 17 | 18 | 19 | 20 | 21 | 22 | 23 24 25 | 26 | 27 | 28 | 29 | 30 July 2001 August 2001 | Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 111213141 111213141516171516171819 | 10 | 11 | 8 9 10 11 12 | 13 | 14 12 | 13 | 14 | 15 | 16 | 17 | 181 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 19 | 20 | 21 | 22 | 23 24 25 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 26 | 27 | 28 | 29 | 30 | 31 | 29 | 30 31 | September 2001 October 2001 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 1 1 1 1 2 3 4 5 6 121 31 41 561718 17 18 19 | 10 | 11 | 12 | 13 | | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | | 16 | 17 | 18 | 19 20 | 21 | 22 | 21 | 22 23 | 24 | 25 26 27 | 23 | 24 | 25 | 26 | 27 | 28 | 29 28 29 30 31 1 301 | November 2001 December 2001 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 11 21 31 1 1 1 1 1 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 | 11 | 12 | 13 | 14 | 15 | 16 | 17 9 | 10 | 11 | 12 | 13 | 14 | 15 | | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 29 | 30 | 23 | 24 | 25 | 26 | 27 28 29 T 30 31 ed-vme #include #include #include "calendar Type.h" using namespace std; // ----- // CS 202 - Assignment #3, Provided Main // Uses the calendar Type class // ---- // Note, while calType class is derived from dateType class, that is hidden from the client program. As such, all of the previous dateType (and day Type) funtions and some more are provided by calType class. The key addition is the month and year boxes. Those functions require the dateType functionality (i.e., the string names). int main() // Various declarations with different constructors. string bars; bars. append(25,'-'); calendar Type today, tomorrow, yesterday; calendar Type tempDay; calendar Type dueDate (2, 19, 2020); calendar Type newYear (1, 1, 2020); calendar Type birthDay (1, 27, 1996); // -- // Set and display federal holdays for 2020. examples of array using day Type object. uses and tests setDate() function. calendar Type federalHolidays2020[10]; federalHolidays 2020[0].setDate(1,1,2020); federalHolidays2020[1].setDate(1,20,2020); federalHolidays 2020[2].setDate(2,17,2020); federalHolidays 2020[3].setDate(5,25,2020); federalHolidays 2020[4].setDate(7,3,2020); federalHolidays 2020[5].setDate(9,7,2020); federalHolidays2020[6].setDate(10,12,2020); federalHolidays 2020[7].setDate(11,11,2020); federalHolidays 2020[8].setDate(11,26,2020); federalHolidays2020[9].setDate(12,25,2020); cout #include #include "dateType.h" using namespace std; // ---- // CS 202 - Assignment #3, Provided Main // Uses the dateType class to test. // The date Type class extends the dayType class and // includes some additional functionality. ===== // ---- // Note, while date Typeclass is derived from day Type class, that is hidden from the client program. As such, all of the previous day Type functions and some more are provided by dateType class. The key addition is the day and month name strings. int main() { // // ----- Various declarations with different constructors. string bars; bars.append(25,'-'); dateType today, tomorrow, yesterday; dateType tempDay; dateType dueDate (2, 19, 2020); date Type newYear (1, 1, 2020); date Type birthDay (1, 27, 1996); 5 set and disperamples destroyed // // ----- Set and display federal holdays for 2020. examples of array using dayType object. uses and tests setDate() function. dateType federalHolidays2020[10]; federal Holidays 2020 [0].setDate(1,1,2020); federal Holidays 2020[1].setDate(1,20,2020); federal Holidays2020[2].setDate(2,17,2020); federalHolidays2020[3].setDate(5,25,2020); federalHolidays2020[4].setDate(7,3,2020); federalHolidays2020[5].setDate(9,7,2020); federalHolidays2020[6].setDate(10,12,2020); federal Holidays2020[7].setDate(11,11,2020); federalHolidays2020[8].setDate(11,26,2020); federalHolidays 2020[9].setDate(12,25,2020); cout #include #include "dayType.h" using namespace std; // ----- // CS 202 - Assignment #3, Provided Main. // Uses the day Type class to test basic functions. int main() // Various declarations with different constructors. string bars; bars.append(25,'-'); day Type today, tomorrow, yesterday; dayType tempDay; dayType dueDate(2, 19, 2020); dayType newYear(1, 1, 2020); dayType birthDay(1, 27, 1996); // // ----- Set and display federal holdays for 2020. examples of array using day Type object. uses and tests setDate() function. dayType federalHolidays2020[10]; federalHolidays 2020[0].setDate(1,1,2020); federalHolidays2020[1].setDate(1,20, 2020); federalHolidays2020[2].setDate(2,17,2020); federalHolidays2020[3].setDate(5,25,2020); federalHolidays2020[4].setDate(7,3, 2020); federalHolidays2020[5].setDate(9,7,2020); federalHolidays2020[6].setDate(10,12,2020); federalHolidays2020[7].setDate(11,11,2020); federalHolidays2020[8].setDate(11,26,2020); federal Holidays2020[9].setDate(12,25,2020); cout , , format. For example, 1/1/1970 would be: Thursday, January 1, 1970. The serDateStrings() function should set the monthName and dayName class variables with the appropriate strings based on the current integer date values. As such, any time the date is altered, the strings must be updated. The getDay Number month date, year) function return the day number 0-6 (0 for a Sunday, 1 for a Monday, 2 for a Tuesday, etc.) for either the current passed date. Refer to the provided formula. The serDate/month, date year) function should set the date to the passed values and set the date strings. If any part of the passed date is invalid, the entire date should be set to the current date (from the OS). The nextDayO and prevDay functions should use the base class functions to increment or decrement the current class date (maintained in the base class) one day. The functions must also set the date strings (via the setDateStrings() function). The nextDay(int) and prevDay (int) functions should use the base class functions to increment or decrement the current class date (maintained in the base class) by the number of days passed (changing month and/or year if necessary). The functions must also set the date strings (via the setDateStrings() function). The ger MonthName) and getDayName() functions return the strings from the corresponding class variables. The roadDate() function should use the base class function to read the date. Then, the function must also set the date strings. Use the provided main, date. Main.cpp, to demonstrate that the dateType class functions correctly. The main and provided makefile reference files date Type imp.cpp and date 7ype.h. Your implementation and header files should be fully commented calendar Type Class The calendar Type class will provide the dateType functionality (which includes the day Type functionality) with some additional functionality. Specifically, the calendar class will add support for printing a month box and an calendar for all twelve months. Since the calendar Class will extend the basic day Type functionality, dateClass will be derived form the da Class. The calendar Type UML class diagram is as follows: calendar Type +calendar Type() +calendar Type (int, int, int +printMonthBox() const: void #printYearBox() const: void Obtaining Current Date The following system calls will obtain the current date. time turl: tm local: time (&currl); local=* (localtime (currl)); // get Current time_t value // dereference and assign month = local.tm_mon + 1; date = local.ta_aday: year = local.tm year + 1900; Note, requires: #include Testing A script file to execute the program on a series of predefined inputs is provided. Please follow the I/O examples. The test utility should be downloaded into the working directory. The script file will require execute privilege (i.e., chmod +x tst3). The test script, named tst3, here can be executed on each of the various mains (dayMain, dateMain, or calMain) as follows: ed&vme ./tst3 dayMain ed@vme ./tst3 dateMain ed&vm ./tst3 calMain The test script compares the program output to predefined expected output (based on the example 10), Note, the ed@vme is the prompt on my machine. Example Execution: Below is an example program execution. You should ensure the program works for various dates and that moving the date forward and backwards correctly reflects the appropriate calendar dates. You can refer to (http://www.timeanddate.com/calendar/) to check dates. Below is an example output for the day Main program ed-vmt ./dayMain Federal Holidays for 2020: Date: 1/1/2020 Date: 1/20/2020 Date: 2/17/2020 Date: 5/25/2020 Date: 7/3/2020 Date: 9/7/2020 Date: 10/12/2020 Date: 11/11/2020 Date: 11/26/2020 Date: 12/25/2020 Today was: Date: 1/1/1970 Today is: Date: 1/31/2020 Tomorrow is: Date: 2/1/2020 Yesterday was: Date: 1/30/2020 Use the provided main, cal Main.cpp, to demonstrate that the calendar Type functions correctly. The main and provided makefile reference files calendar TypeImp.cpp and calendar Type.h. Your implementation and header files should be fully commented. Each class must be fully completed prior to moving on to the next. Refer to the example executions for output formatting. Make sure your program includes the appropriate documentation. See Program Evaluation Criteria for CS 202 for additional information Make File: The provided make file assumes the source file names are as described above. If you change the names, the make file will need to be edited accordingly. To build the day Type class, dateType class, or calendar Type class provided mains; make day Main make dateMain make calmain Which will create the day Main (for dayType class), date Main (for dateType class), and calMain (for calendar Type class) executables respectively. Submission: Submit a compressed zip file of the program source files, header files, and makefile via the on- line submission All necessary files must be included in the ZIP file. The grader will download, uncompress, and type make (so you must have a valid, working makefile). Day of Week Formula: To calculate the day on which a particular date falls, the following algorithm may be used (the divisions are integer divisions): = 14 - month 12 y = year - a m = month + 12 2 - 2 1 = [ date + y + *- lo + 4 0 + 34 m) mod 7 The value of d is 0 for a Sunday, 1 for a Monday, 2 for a Tuesday, etc. Leap Year A year is a leap year if it is evenly divisible by 4, but not evenly divisible by 100. However, if the year is evenly divisible by 400, it is a leap year. Obtaining Current Date The following system calls will obtain the current date. time turl: tm local: time (&currl); local=* (localtime (currl)); // get Current time_t value // dereference and assign month = local.tm_mon + 1; date = local.ta_aday: year = local.tm year + 1900; Note, requires: #include Testing A script file to execute the program on a series of predefined inputs is provided. Please follow the I/O examples. The test utility should be downloaded into the working directory. The script file will require execute privilege (i.e., chmod +x tst3). The test script, named tst3, here can be executed on each of the various mains (dayMain, dateMain, or calMain) as follows: ed&vme ./tst3 dayMain ed@vme ./tst3 dateMain ed&vm ./tst3 calMain The test script compares the program output to predefined expected output (based on the example 10), Note, the ed@vme is the prompt on my machine. Example Execution: Below is an example program execution. You should ensure the program works for various dates and that moving the date forward and backwards correctly reflects the appropriate calendar dates. You can refer to (http://www.timeanddate.com/calendar/) to check dates. Below is an example output for the day Main program ed-vmt ./dayMain Federal Holidays for 2020: Date: 1/1/2020 Date: 1/20/2020 Date: 2/17/2020 Date: 5/25/2020 Date: 7/3/2020 Date: 9/7/2020 Date: 10/12/2020 Date: 11/11/2020 Date: 11/26/2020 Date: 12/25/2020 Today was: Date: 1/1/1970 Today is: Date: 1/31/2020 Tomorrow is: Date: 2/1/2020 Yesterday was: Date: 1/30/2020 Due Date is: Date: 2/19/2020 Constructor and setDate error testing Date: 1/1/1970 Date: 1/1/1970 Date: 1/1/1970 Date: 2/29/2020 Date: 1/1/1970 Date: 1/1/1970 Date: 1/1/1970 Date: 1/1/1970 Date: 1/1/1970 Date: 1/1/1970 Date: 1/1/1970 When is new years day? Enter date (mm/dd/year): 1/35/2020 Invalid date, please re-enter. Enter date (mm/dd/year): 1/0/2020 Invalid date, please re-enter. Enter date (mm/dd/year): 1/1/2020 News Year Day: Date: 1/1/2020 News Year Eve: Date: 12/31/2019 Next Month: Date: 2/2/2020 Last Quarter Month: Date: 10/3/2019 Mid Year: Date: 7/1/2020 When is your birthday? Enter date (mm/dd/year): 6/31/2001 Invalid date, please re-enter. Enter date (mm/dd/year): 6/30/2001 Your lucky number is 6 + 30 + 2001 - 2037 ed-vme Below is an example program execution for the date. Main program. ed-vme ./dateMain Federal Holidays for 2020: Date: Wednesday, January 1, 2020 Date: Monday, January 20, 2020 Date: Monday, February 17, 2020 Date: Monday, May 25, 2020 Date: Friday, July 3, 2020 Date: Monday, September 7, 2020 Date: Monday, October 12, 2020 Date: Wednesday, November 11, 2020 Date: Thursday, November 26, 2020 Date: Friday, December 25, 2020 Today is: Date: Friday, January 24, 2020 Due Date is: Date: Wednesday, February 19, 2020 Tomorrow is: Date: 1/25/2020 Yesterday was: Date: 1/23/2020 When is new years day? Enter date (mm/dd/year): 1/90/2020 Invalid date, please re-enter. Enter date (mm/dd/year): 1/1/2020 News Year Day: Date: Wednesday, January 1, 2020 News Year Eve: Date: Tuesday, December 31, 2019 Next Month: Date: Sunday, February 2, 2020 Last Quarter Month: Date: Thursday, October 3, 2019 Mid Year: Date: Wednesday, July 1, 2020 When is your birthday? Enter date (mm/dd/year): 2/30/2000 Invalid date, please re-enter. Enter date (mm/dd/year): 2/29/2000 Your birthday Date: Tuesday, February 29, 2000 Yeah, Tuesday's are lucky! Your lucky number is 2 + 29 - 2000 - 2031 ed-vme ed-vme Below is an example program execution for the calMain program. ed-vme /calMain Federal Holidays for 2020: Date: Wednesday, January 1, 2020 Date: Monday, January 20, 2020 Date: Monday, February 17, 2020 Date: Monday, May 25, 2020 Date: Friday, July 3, 2020 Date: Monday, September 7, 2020 Date: Monday, October 12, 2020 Date: Wednesday, November 11, 2020 Date: Thursday, November 26, 2020 Date: Friday, December 25, 2020 Today is: Date: Friday, January 24, 2020 Due Date is: Date: Wednesday, February 19, 2020 Tomorrow is: Date: Saturday, January 25, 2020 Yesterday was: Date: 1/23/2020 When is new years day? Enter date (mm/dd/year): 1/32/2020 Invalid date, please re-enter. Enter date (mm/dd/year): 1/1/2020 News Year Day: Date: Wednesday, January 1, 2020 News Year Eve: Date: Tuesday, December 31, 2019 Next Month: Date: Sunday, February 2, 2020 Last Quarter Month: Date: Thursday, October 3, 2019 Mid Year: Date: Wednesday, July 1, 2020 Month Box | July 20201 | Su Mo Tu We Th Fr Sa 1 11213141 15 16 17 18 19 | 10 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 24 25 26 27 28 29 30 31 1 When is your birthday? Enter date (mm/dd/year): 2/29/2001 Invalid date, please re-enter. Enter date (mm/dd/year): 2/28/2001 Yeah, Wednesday are lucky! Your lucky number is 2 - 28 - 2001 - 2031 Birthday Month Box February 2001 | Su Mo Tu We Th Fr Sa 1 112131 14 15 16 17 18 19 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 Non Leap Year Month Box | February 20201 Su Mo Tu We Th Fr Sa 1 121314151617181 1 9 | 10 | 11 | 12 | 13 | 14 | 15 | | 16 | 17 | 18 | 19 | 20 | 21 | 22 | I 23 24 | 25 | 26 | 27 | 28 | 29 I Leap Year Month Box | February 20201 Su Mo Tu We Th Fr Sa ! 1 1 1 1 | 2 | 3 | 4 | 5 | 6 | 7 | 81 9 | 10 | 11 | 12 | 13 | 14 | 15 | | 16 | 17 | 18 | 19 | 20 | 21 | 22 | | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Leap Year Month Box July 2020 | Su Mo Tu We Th Fr Sa ! 111213141 15 16 17 18 19 | 10 | 11 | | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 20 21 22 23 24 25 I 26 27 28 29 30 31 Year Box Test | January 20011 February 2001 1 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 1 11 21 31 41 51 61 1 11 21 31 17 18 19 | 10 | 11 | 12 | 13 | 14 | 5 | 6 | 7 | 8 | 9 | 10 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 28 | 29 | 30 | 31 1 | 25 | 26 | 27 | 28 I March 2001 April 2001 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 112131 14 15 16 17 18 19 | 10 111213141516171 | 11 | 12 | 13 | 14 | 15 | 16 | 17 1 8 19 | 10 | 11 | 12 | 13 | 14 | | 18 | 19 | 20 | 21 | 22 | 23 | 24 15 | 16 | 17 | 18 | 19 | 20 | 21 | I 25 | 26 | 27 | 28 29 | 30 | 31 | 22 | 23 | 24 | 25 26 27 | 28 1 29 130 May 2001 June 2001 I Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 1 1121314151 11 21 16 17 18 19 | 10 | 11 | 12 13 14 15 16 17 18 19 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 31 1 | 17 | 18 | 19 | 20 | 21 | 22 | 23 24 25 | 26 | 27 | 28 | 29 | 30 July 2001 August 2001 | Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 111213141 111213141516171516171819 | 10 | 11 | 8 9 10 11 12 | 13 | 14 12 | 13 | 14 | 15 | 16 | 17 | 181 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 19 | 20 | 21 | 22 | 23 24 25 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 26 | 27 | 28 | 29 | 30 | 31 | 29 | 30 31 | September 2001 October 2001 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 1 1 1 1 2 3 4 5 6 121 31 41 561718 17 18 19 | 10 | 11 | 12 | 13 | | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | | 16 | 17 | 18 | 19 20 | 21 | 22 | 21 | 22 23 | 24 | 25 26 27 | 23 | 24 | 25 | 26 | 27 | 28 | 29 28 29 30 31 1 301 | November 2001 December 2001 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 11 21 31 1 1 1 1 1 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 | 11 | 12 | 13 | 14 | 15 | 16 | 17 9 | 10 | 11 | 12 | 13 | 14 | 15 | | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 29 | 30 | 23 | 24 | 25 | 26 | 27 28 29 T 30 31 ed-vme #include #include #include "calendar Type.h" using namespace std; // ----- // CS 202 - Assignment #3, Provided Main // Uses the calendar Type class // ---- // Note, while calType class is derived from dateType class, that is hidden from the client program. As such, all of the previous dateType (and day Type) funtions and some more are provided by calType class. The key addition is the month and year boxes. Those functions require the dateType functionality (i.e., the string names). int main() // Various declarations with different constructors. string bars; bars. append(25,'-'); calendar Type today, tomorrow, yesterday; calendar Type tempDay; calendar Type dueDate (2, 19, 2020); calendar Type newYear (1, 1, 2020); calendar Type birthDay (1, 27, 1996); // -- // Set and display federal holdays for 2020. examples of array using day Type object. uses and tests setDate() function. calendar Type federalHolidays2020[10]; federalHolidays 2020[0].setDate(1,1,2020); federalHolidays2020[1].setDate(1,20,2020); federalHolidays 2020[2].setDate(2,17,2020); federalHolidays 2020[3].setDate(5,25,2020); federalHolidays 2020[4].setDate(7,3,2020); federalHolidays 2020[5].setDate(9,7,2020); federalHolidays2020[6].setDate(10,12,2020); federalHolidays 2020[7].setDate(11,11,2020); federalHolidays 2020[8].setDate(11,26,2020); federalHolidays2020[9].setDate(12,25,2020); cout #include #include "dateType.h" using namespace std; // ---- // CS 202 - Assignment #3, Provided Main // Uses the dateType class to test. // The date Type class extends the dayType class and // includes some additional functionality. ===== // ---- // Note, while date Typeclass is derived from day Type class, that is hidden from the client program. As such, all of the previous day Type functions and some more are provided by dateType class. The key addition is the day and month name strings. int main() { // // ----- Various declarations with different constructors. string bars; bars.append(25,'-'); dateType today, tomorrow, yesterday; dateType tempDay; dateType dueDate (2, 19, 2020); date Type newYear (1, 1, 2020); date Type birthDay (1, 27, 1996); 5 set and disperamples destroyed // // ----- Set and display federal holdays for 2020. examples of array using dayType object. uses and tests setDate() function. dateType federalHolidays2020[10]; federal Holidays 2020 [0].setDate(1,1,2020); federal Holidays 2020[1].setDate(1,20,2020); federal Holidays2020[2].setDate(2,17,2020); federalHolidays2020[3].setDate(5,25,2020); federalHolidays2020[4].setDate(7,3,2020); federalHolidays2020[5].setDate(9,7,2020); federalHolidays2020[6].setDate(10,12,2020); federal Holidays2020[7].setDate(11,11,2020); federalHolidays2020[8].setDate(11,26,2020); federalHolidays 2020[9].setDate(12,25,2020); cout #include #include "dayType.h" using namespace std; // ----- // CS 202 - Assignment #3, Provided Main. // Uses the day Type class to test basic functions. int main() // Various declarations with different constructors. string bars; bars.append(25,'-'); day Type today, tomorrow, yesterday; dayType tempDay; dayType dueDate(2, 19, 2020); dayType newYear(1, 1, 2020); dayType birthDay(1, 27, 1996); // // ----- Set and display federal holdays for 2020. examples of array using day Type object. uses and tests setDate() function. dayType federalHolidays2020[10]; federalHolidays 2020[0].setDate(1,1,2020); federalHolidays2020[1].setDate(1,20, 2020); federalHolidays2020[2].setDate(2,17,2020); federalHolidays2020[3].setDate(5,25,2020); federalHolidays2020[4].setDate(7,3, 2020); federalHolidays2020[5].setDate(9,7,2020); federalHolidays2020[6].setDate(10,12,2020); federalHolidays2020[7].setDate(11,11,2020); federalHolidays2020[8].setDate(11,26,2020); federal Holidays2020[9].setDate(12,25,2020); cout