Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part II Daylight saving 12 11 DON'T FORGET TO 3 10 9 8 16 4 SPRING FORWARD Daylight saving for 2021 will begin at 2:00
Part II Daylight saving 12 11 DON'T FORGET TO 3 10 9 8 16 4 SPRING FORWARD Daylight saving for 2021 will begin at 2:00 AM on Sunday, March 14 and ends at 2:00 AM on Sunday, November 14. In this part of the assignment, you are asked to complete and test two functions in the week7 daylight saving program. struct Date int month, day; }; void collect_date(Date &d); void daylight_message(Date d); struct Date { int month, day; }; void collect_date(Date &d); void daylight_message(Date d); The collect_date function is to prompt the user enter a date in the "MM/DD" format. The function then shall store the month and day information into the month and day data members of the Date parameter. You may assume only valid dates will be entered by users. The daylight_nessage function is to display a message based on how the Date object compares to the daylight saving time this year. If the Date parameter is before March 14, the function shall display a message indicating when the daylight saving will start. If the Date parameter is on March 14, the function shall display a message reminding people to spring forward an hour If the Date parameter is March 18 through November 6, the function shall display a message confirming the date is during daylight saving. If the Date parameter is on November 7, the function shall display a message reminding people to fall back an hour. If the Date parameter is after November 7, the function shall display a messaging indicated when the daylight saving ended. The main function current includes the declaration of a Date object and a pair of function calls. This allows you to test the above functions for one date. As shown in the above bullet list, there are several scenarios of dates you would need to consider in the daylight_message function. You are encouraged to focus on getting your daylight_message function to work for one scenario and test it before expanding it to take care of another scenario. As the dayligh_message function is expanded, add more pairs of function calls in the main function to help test additional scenarios. The following screenshot shows a sample run of a completed program. The dates were entered by the user. You are required to test the daylight_message function using at least three dates that are different from the dates provided below. Enter a date in MM/DD formate: 01/29 Daylight saving will start on March 14. Enter a date in MM/DD formate: 03/06 Daylight saving will start on March 14. Enter a date in MM/DD formate: 03/14 This is the beginning of daylight saving. Don't forget to spring forward an hour. 03/20 Enter a date in MM/DD formate: Enjoy daylight saving. Enter a date in MM/DD formate: 06/16 Enjoy daylight saving. Enter a date in MM/DD formate: 11/02 Enjoy daylight saving. Enter a date in MM/DD formate: 11/07 This is the end of daylight saving. Don't forget to fall back an hour. Enter a date in MM/DD formate: 11/11 Daylight saving ended on November 7. Enter a date in MM/DD formate: 12/31 Daylight saving ended on November 7
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started