Use the GENNY to finish this work, I have finished the problem A and done the part of problem B. But I do not know why it does not work.
Problem B: Including days (20 points)
This is a challenging problem. Its purpose is to give you experience with complicated programming logic. Expect this problem to be longer and more difficult than the previous problems in this class.
To begin, copy your solution from Problem A. Name the copy <username> 2B.cpp, where you replace <username> with your U of M username. In this part make sure you modify the copy, not your original Problem A file.
This part introduces two requirements beyond those in Problem A:
- Your program should include days. Specifically the user input should include the days for the initial date and include days in the change. And the new date calculation and output should include the days as well.
- Your program should change the date by the number of months (if any), and then the number of days (if any). If, after changing the number of months, the day of the month is invalid, change the day to the last day of that month.
For example, if the initial date was 03/30/2015 and the change was 1 month 2 days earlier, it should be 02/26/2015 (one month earlier is 02/28/2015 and two days earlier than that is 02/26/2015). This is not the only way to handle this situation, but it is the way we will handle it for the purposes of this homework.
Other than the changes due to these two requirements, your program should behave the same as in Part A.
Here are a few additional clarifications:
- You may again assume without checking that the original date input is a valid date. And you may assume without checking that the change in date is a valid change, with the change being positive (months and days nonnegative, and direction being ’earlier’ or ’later’).
- The output date should always be a valid date. So, for example, suppose the user inputs an original date of 03/30/2015 and a change of ’1 0 earlier’, the output date should be 02/28/2015, not 02/30/2015.
- Problem solving hint: while this problem might seem easy at first, the logic is nontrivial. This program is intended to be challenging. Start this problem early, and think (before writing code) of what steps your solution will need to perform, and in what order. Your program will need to handle a number of different situations, so make sure you understand the requirements and the solution logic carefully before writing code.
3
• If you cannot get the entire program to work, get as much of it to work as you can. Specifically, try to get the days in the dates working correctly even if you do not get the change by number of days requirement implemented. Turning in a program that compiles and handles some of the possible cases correctly will give you more points than turning in nothing, or turning in a program that does not compile.
Here are a few examples:
Example 1:
Original date (month, day, year): 09 05 2015
Change to date (# of months, # of days, ’earlier’ or ’later’): 13 2 earlier New date (month, day, year): 08 03 2014
Example 2:
Original date (month, day, year): 04 02 2015
Change to date (# of months, # of days, ’earlier’ or ’later’): 1 5 earlier New date (month, day, year): 02 25 2015
Example 3:
Original date (month, day, year): 09 05 2015
Change to date (# of months, # of days, ’earlier’ or ’later’): 13 0 earlier New date (month, day, year): 08 05 2014
Last Completed Projects
| topic title | academic level | Writer | delivered |
|---|
Are you looking for a similar paper or any other quality academic essay? Then look no further. Our research paper writing service is what you require. Our team of experienced writers is on standby to deliver to you an original paper as per your specified instructions with zero plagiarism guaranteed. This is the perfect way you can prepare your own unique academic paper and score the grades you deserve.
Use the order calculator below and get started! Contact our live support team for any assistance or inquiry.
[order_calculator]