Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
OK, welcome back.
And in this solution, what we are going to do, what are we going to do is to find the next day, right?
So we will need to get all the information for our current date, for example, the day, the month
and the year.
And right afterward, we should find the next day while taking into consideration all the things that
we've specified before.
For example, if we are at the last day of the month, if it's a leap year or not, and so on and so
forth.
So let's start by creating three variables in day, month and year.
OK, so in day, month and year and also we'll specify and leap year equals do zero.
OK, so day, month, year and leap year equals to zero, which is simple default.
OK, that I will use for this video some default that says the leap the year is not leap.
Otherwise if we will change it it will be like not zero will specify that it's a leap year.
OK, for example.
So let's just start getting all the information, enter the day or enter day and in this case enter
the day.
We will use it to read the day just kind of percentage and store it inside variable day.
OK, and the same we are going to do also for the month, right.
Oops.
Sorry about the month and about the year.
OK, so month and year.
And one thing that I want to mention here in this video, guys, is that once again, you see that I
don't use only presentations.
I use like hands on with you guys to solve different exercises.
And sometimes it take us a little bit more time.
But I think this step by step tutorial that I go with you together is really it's really worth you,
because from my experience, a lot of students prefer this way of teaching, and I hope that you, too.
Anyway, let's get back to business and let's use here the end of month and the unberth percent of year.
OK, awesome.
So enter a day, enter month and enter year.
And now what should we do?
What should we basically do and why?
What will be our next move?
So what I suggest is simply to you, first of all, let's find out if a given year is leap or not,
OK, or not.
So how can we do it?
We can simply use the following conditions that we had.
But what I will do is simply to kind of to kind of let's see if we are interested in a leap year.
The only thing that is going to interest us is if a given month is simply February.
Right.
Because otherwise we don't care if the year is leap or not.
So let's say if month equals two, what is it is still right.
Because if it's February, February, and also if the year is leap, so if let's say year MODULA, I
just want to summarize all of the conditions that we've used in the previous video to one condition.
So if you're it can be divided by four without a remainder and also the year can be divided by a hundred,
OK, with some remainder or basically the year cannot be divided by hundred without a remainder or the
year it can be divided by a hundred four hundred without the remainder.
OK, so that's just the formal conditions that we've used in our previous in our previous video.
So let's just make sure that everything was OK.
So a year divided by four without the remainder and also and also OK.
And also either the year cannot be divided by a hundred year or a year can be divided by 400.
So OK, so if it can be divided by four without the remainder and also either of these condition seems
to be true.
So hopefully guys, make sure that you check out this condition.
If I have done it for 100 percent, OK, because.
This exercise is not all about it, but still, anyway, just make sure you check me out, maybe you
have some small mistake here.
I'm not sure about it.
So if if so, I will, of course, update the content in some description below.
But until then, let's simply proceed so we are equals to one.
And that means that the year is what is it?
It's like, OK, so awesome.
So now all that remains to do is simply to move one day further.
So day plus equals to one.
So we simply use day equals to the previous day plus one.
OK.
Whoo!
So now we need to take into consideration a lot of options and these options basically are based on
the month.
Right.
We previously used some exercise with months just to get the number of the month into print, the name
of the month and we used switch case option.
So probably here it will be also a good idea.
Let's use switch case switch case on month, OK, and switch case on month because we know there may
be months with a lot of different on days.
So we know that if we are going to use for example, the first month.
Right.
So it's case one, it's January, it may be case three, which is marriage case five.
And that's basically, guys, some information that I'm taking from the calendar and I can see which
days have, you know, like thirty one days in which days, which months have 30 days and we each have
thirty one.
So it will be case seven.
OK, I'm not inventing here anything.
OK, so I'm simply writing the conditions.
So case 10 and case is December Yuki's December.
So case twelve.
So if month equals to one or month equals to three or month equals to five and so on.
If that's the case we will check if day after it was incremented is less or equal to thirty one.
And if that's the case that's OK.
That means we do not have to move one month further.
OK, so break.
And in this case we know that that's that, that's OK.
Awesome.
So we know it's about these days.
And also let's check now about the other months.
So it will be like what was it case for case six, which is June oh, case nine.
I think it's September case.
What was it.
Case eleven November and yeah, I think that's it.
Right.
We have one, two, three, four, five, six, seven.
OK, six, seven and four.
OK, exactly.
So now let's check if day is less than or equal to thirty three.
That's the case.
It's also OK.
Right, because we know that the next day you stealing range and we do not have to move month one further
or so break.
And that's also OK.
And now let's read the last month, which is the most problematic.
But the month with that relies on the fact that if we have leap year or not, leap year or so, case
two, and if that's February, right.
It's fair but fair.
But rule three.
And if that's the case, we should ask the following question.
If the day is less than or equal to twenty nine, but it's a leap year.
Let's say leap year equals one, then that's OK.
That's OK.
But if we know that it's not the leap year.
OK, so let's do break ok.
And else if else if and if we will say the day is less than or equal to twenty eight which is also OK
we'll also use break.
OK, so simply what we are doing in these switch cases is just to like to take into account all the
necessary information for us to like to work with are the days to work with the days where we don't
have to move month neither neither month nor a year one ahead, which are simply just to increment day
by one and everything works correctly.
So that's this one.
And that's this one.
And that's the case.
OK, so if days less than.
Less than or equal to 31 in either of these months or an equal LFS or less than 30 in these months and
so on.
So that's OK.
But if this condition was false or this condition was false, again, it's very important to notice
here how this case works.
If this condition was false or in this condition was false or if this condition was false, either of
them, OK, basically this condition was not executed or if this condition was not executed, then the
break command that simply issued, like, you know, like to get you out of this, which case statement
then it would not have been executed.
So what are the part that will be executed is the default part and the default part goes like this.
So we will say that the they should be equal to one, because if we move to the next month, the month
should be equal to like the next month.
So months equal to to the previous month plus one.
It also will say that each month is greater than 12.
OK, right.
Because it can be like if we have like if we've been on December and we added just one, OK, then we've
moved to the next month, which is like January.
So it will be it should be a month equal to one.
So this case will specify that month it was two one and also year added by one case.
So year equal to the previous year plus one.
That's how we should do it.
And it's guys, it's super important to understand the structure here once again.
So we are running over the months.
We check if a given condition of each day is less than or equal to thirty one.
If that's the case, we break and we get out of this switch case once and for all.
But even that's not the case.
Each day was like, I don't know, thirty two.
Then in this case the result of this condition would have been false and the break would not have been
executed.
And you would simply jump OK to the default section and you would say the equal to one month plus equal
to one and you would simply increment everything by one and both the month and also the year if it's
necessary.
And once you are done in your out of this, which case you will simply print the next day.
So the next.
The next.
Let's say the next awesome day is and let's use, I don't know, percentage D, percentage D and the
percentage, then, OK, so that's basically what we would have printed out and backslash.
And of course, and we use here day and year, which all of them are already updated to the next day.
So awesome.
Let's build and run it and see what happens if we insert here.
I don't know.
What was it like.
Mm hmm.
Into the day and through the month.
Just an arbitrary I in 1998.
So the next thousand days, twenty six will look awesome.
But if we will have a leap year, let's see.
Twenty eight to February.
Twenty twenty.
So the next day.
Twenty nine of February.
Twenty twenty.
Awesome guys.
So I think this program works perfectly even if we take like twenty eight February 2019, which is not
a leap year.
So the next day's the 1st of 2019.
So awesome, awesome, awesome, awesome.
Guys still if you have any questions about this exercise, it was not so easy, it was kind of difficult.
Feel free to ask me and yeah, hopefully you like the video and you like the solution and you feel like
you're getting more confident.
You're developing real programs that may find the next day based on a given day, which is already showing
your progress.
So let me know if you like this video.
If you like the course so far, if you like the way of teaching, your review really matters.
And it keeps me motivated for creating you additional content and additional courses.
So thank you so much for watching.
Have a great day and I will see you in the next videos.
Of course.
Until then, my name is Vlad.
This is Alphatech and I will see you guys by.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.