Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hina had recharged her mobile network with an available pack, which has certain days of validity. She needs to calculate the date for her next

Hina had recharged her mobile network with an available pack, which has certain days of validity. She needs to calculate the date for her next recharge to keep a remainder for herself. Help her by getting the recharged date and validity days as input and Calculate the next recharge date.

Note:

The input recharged date, must be in dd/MM/yyyy format, which is on or before the current date. Otherwise, print "<> is not a valid date" and terminate

The input validity days, must be greater than 0. Otherwise, print "<> is not a valid days" and terminate

The output must be the calculated next recharge date in dd/MM/yyyy format.

Additionally please validate the below scenarios as well

Check for date with invalid month format

Check for date with invalid day format

Assumption: Consider the system current date as 29/10/2019

Sample Input 1:

Recharged date

02/02/2019

Validity days

84

Sample Output 1:

27/04/2019

Sample Input 2:

Recharged date

29/10/2109

Sample Output 2:

29/10/2109 is not a valid date

Sample Input 3:

Recharged date

29/10/2019

Validity days

-60

Sample Output 3:

-60 is not a valid days

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

Students also viewed these Programming questions