Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Larry Ellison Database Genius Of Oracle

Authors: Craig Peters

1st Edition

0766019748, 978-0766019744

More Books

Students also viewed these Databases questions

Question

Develop successful mentoring programs. page 400

Answered: 1 week ago