Imagine that you and your friend have been asked to write a C++ program to list
ID: 3883787 • Letter: I
Question
Imagine that you and your friend have been asked to write a C++ program to list all the 10 U.S. federal holidays in increasing calendaristic order. (Rules on deciding these holidays are presented here: https: //www.redcort.com/us-federal-bank-holidays/_). You decide to split the task as follows: -Your friend will write the code for a Holiday class - You will write the main function that will use the Holiday class Your friend provides you the following header file containing only the class declaration: class Holiday { public: Holiday (string holidayDate): // initialize with the given holiday's // date in the calendar Int getDay (): // return the day of the holiday Int getMonth(): // return the month (1 - 12) of the holiday }: a) Is this header file sufficient for you to write your main function code? Or do you also need to see the Holiday class' source file with the class definition? b) Is this header file sufficient for you to compile your program? Or do you alsoExplanation / Answer
A) Yes, the header file is sufficient to write the main function code by just ensuring that you use command --> #include "Holiday.h" at the top of your program. This will allow you to use functions of the class Holiday in your program. This is something similar to how we use 'iostream.h' header and it's functions to write the main function code. Moreover, the basic declaration of methods is already given so we know what arguments to pass in which methods and what values (data type) will a function return.
B) No, this header file isn't sufficient to compile the program since the source file (would be having a name, such as, Holiday.cpp) also needs to be compiled into any project that uses Holiday.h so the linker knows how Holiday is implemented.