Reusing functions from Problem 8 as appropriate, write a C++ program that computes the number of days between two dates. If your design for Problem 8 used good functional decomposition, this should be a trivial program to write. You merely need to input two dates, convert them to their JDNs, and take the difference of the JDNs. Your program should make appropriate use of value-returning functions in solving this problem. These formulas require nine significant digits; you may have to use the integer type long and the floating-point type double. Your program should prompt theuser appropriately for input of the date; it should also properly label the output. Use proper coding style with comments to document the algorithm as needed.
REF PRB:
Write a program that determines the day of the week for a given date. You can invent your own complex algorithm that takes into account the special leap year rules, and changes in calendars, but this is a case where it makes sense to look for things that are familiar. Who else might need to compute values from dates over a wide span of time? Historians work with dates, but generally don’t compute from them. Astronomers, however, need to know the difference in time between orbital events in the solar system that span hundreds of years. Consulting an astronomy text, you will find that there is a standard way of representing a date, called the Julian Day Number (JDN). This value is the number of days that have elapsed since January 1, 4713 B.C. Given the JDN for a date, there is a simple formula that tells the day of the week:
DayOfWeek = (JDN + 1) % 7
The result is in the range of 0 to 6, with 0 representing Sunday.
The only remaining problem is how to compute the JDN, which is not so simple. The algorithm computes several intermediate results that are added together to give the JDN. We look at the computation of each of these three intermediate values in turn.
If the date comes from the Gregorian calendar (later than October 15, 1582), then
compute intRes1 with the following formula; otherwise, let intRes1 be zero.
Your program should make appropriate use of value-returning functions in solving this problem. These formulas require nine significant digits; you may have to use the integer type long and the floating-point type double. Your program should prompt the user appropriately for input of the date; it should also properly label the output. Use proper coding style with comments to document the algorithm as needed.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.