Question: Holidays Using the date class, create a list of at least 5 holidays. You may use either a vector or an array. Write a function
Holidays
Using the date class, create a list of at least 5 holidays. You may use either a vector or an array.
Write a function that will receive the current year and return the date for Thanksgiving. Add that to the list.
Sort the list and print the name of the holiday and the day of the week for each holiday. (Hint: use an array for the days "Sunday", "Monday", etc.!)
Thanksgiving falls on the fourth Thursday of November (not the last Thursday as some months have five Thursdays). Additionally, Thanksgiving falls between the 22nd and the 28th of the month. There are some exceptions to these rules, specifically in 1940 and 1941 when Thanksgiving was held on the third Thursday.
Method: One way is to find the day of the week for Nov. 1 using the day of week method. Then figure out the date for the first Thursday. Then add 21 to get the date of the 4th Thursday. You may use any method that calculates the date. Hint: A nice solution to this is to use an array with the day of the week of the first day of the week as the index. If Nov. 1 is a Sunday, then Thanksgiving is 26. If Nov. 1 is a Monday, then Thanksgiving is 25.
This is for C++!!!!!!!!!!!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
