Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,700 --> 00:00:06,470
So let's start writing our program, our monthly program right away, guys.
2
00:00:07,210 --> 00:00:13,480
So let's start with something that we already know how it should be done.
3
00:00:13,490 --> 00:00:17,550
First of all, we know that we have to receive some month value, right.
4
00:00:18,160 --> 00:00:26,110
We are going to let the user insert these value so into the month, the month number.
5
00:00:26,650 --> 00:00:29,040
And that's what the user is going to insert.
6
00:00:29,050 --> 00:00:31,070
So enter the month number.
7
00:00:31,570 --> 00:00:39,520
So in this case, we will read the information from the user and story inside of variable month, and
8
00:00:39,520 --> 00:00:40,030
that's it.
9
00:00:40,930 --> 00:00:44,800
Now, what we have to do is simply to think about what should be the solution.
10
00:00:44,830 --> 00:00:54,070
So what we should do is simply map OK from a given number to some value, write to some representation
11
00:00:54,070 --> 00:00:55,930
of the month, the name of the month.
12
00:00:56,320 --> 00:01:02,260
So if we know that if we received one, then in this case we should bring in January and so on.
13
00:01:02,440 --> 00:01:02,720
Right.
14
00:01:02,740 --> 00:01:04,840
So we simply need something to map.
15
00:01:05,650 --> 00:01:11,620
Of course, we could do it with some basic FLC if and FLC and so on, so, so forth.
16
00:01:11,920 --> 00:01:19,480
But this approach we talked about it in the switch cases section probably is not the best idea.
17
00:01:19,510 --> 00:01:24,520
So what is a better idea is simply to use switch case.
18
00:01:24,520 --> 00:01:32,050
So to switch and we are going to specify the variable that we are going to run in to check all of its
19
00:01:32,050 --> 00:01:32,740
conditions.
20
00:01:32,950 --> 00:01:40,970
So switch month and now we will specify different cases that these variable month can have.
21
00:01:41,440 --> 00:01:49,180
So the first case is case one and by saying case one, this simply means it's kind of analogy to if
22
00:01:49,180 --> 00:01:50,800
month equals to one.
23
00:01:51,160 --> 00:01:54,290
And that's now let's move to the second one.
24
00:01:54,310 --> 00:01:58,630
So case two, OK, so case two, that's the second case.
25
00:01:58,710 --> 00:02:06,660
In this case, we should simply print February, February, write that some application that we were
26
00:02:06,670 --> 00:02:07,300
creating.
27
00:02:07,330 --> 00:02:08,270
OK, and that's OK.
28
00:02:08,320 --> 00:02:15,520
It's not a complex application, but it's a kind of longer than the usual programs that we've written.
29
00:02:15,530 --> 00:02:21,280
But it's kind of nice, right, because we actually get some feeling about the real application.
30
00:02:21,310 --> 00:02:27,220
OK, so suppose that you have to write this really program that gets some number and it's capable of
31
00:02:27,220 --> 00:02:29,690
printing the actual name of the month.
32
00:02:30,160 --> 00:02:35,700
And in this case, let's add also case three and printer for what I think.
33
00:02:37,860 --> 00:02:39,750
OK, so also break.
34
00:02:40,120 --> 00:02:43,880
And there you go again and again and again for all the cases.
35
00:02:43,890 --> 00:02:49,680
So let's simply just copy it and and it's like that.
36
00:02:49,860 --> 00:02:51,300
Like that.
37
00:02:51,300 --> 00:02:54,090
And finally like this.
38
00:02:54,120 --> 00:02:55,620
OK, so.
39
00:02:57,370 --> 00:03:00,160
OK, so now that's simply modified.
40
00:03:00,390 --> 00:03:06,220
OK, it's also OK, the best approach is not to use here or copy paste, but since I know your time
41
00:03:06,220 --> 00:03:09,130
is precious, I decided to take this risk.
42
00:03:09,130 --> 00:03:20,050
So case four is a real and R case five is a case six is June.
43
00:03:21,310 --> 00:03:24,280
Case seven is July.
44
00:03:25,540 --> 00:03:26,620
Case eight.
45
00:03:26,770 --> 00:03:27,360
Where is it.
46
00:03:27,490 --> 00:03:30,120
Case eight is what is it.
47
00:03:30,300 --> 00:03:30,880
August.
48
00:03:32,030 --> 00:03:46,820
Our case, nine years of timber supply timber case 10 is October, case 11 is, what is it, November,
49
00:03:47,810 --> 00:03:54,650
and case 12 is December, the same in her case.
50
00:03:54,660 --> 00:03:57,740
So, yeah, basically, that's it.
51
00:03:57,750 --> 00:03:58,210
Right.
52
00:03:58,430 --> 00:04:01,640
These are all the cases that I wanted to cover.
53
00:04:01,650 --> 00:04:05,270
So it's January, February, March, the date.
54
00:04:05,540 --> 00:04:07,960
OK, so everything seems to be working correctly.
55
00:04:08,300 --> 00:04:12,950
We received some number from the user and we print the corresponding month.
56
00:04:12,960 --> 00:04:15,700
Made our case so awesome.
57
00:04:16,460 --> 00:04:23,240
And last question that remains here is basically what should you do if you receive some number, which
58
00:04:23,240 --> 00:04:29,740
is not in this range, which is not one up to 12, for example, 13 or minus two.
59
00:04:30,290 --> 00:04:37,460
So you also have to treat this case in some way and that's how you do it, in which case of the default.
60
00:04:37,460 --> 00:04:46,370
If it's not, neither are any value from one up to 12, then in this case, simply some error message
61
00:04:46,370 --> 00:04:48,620
here or try again.
62
00:04:48,980 --> 00:04:55,580
I don't know, try again sometime between one to 12.
63
00:04:55,640 --> 00:05:03,080
OK, so that's my recommendation on how you should solve this exercise and basically how you should
64
00:05:03,470 --> 00:05:07,430
apply the default value, the default case.
65
00:05:07,640 --> 00:05:13,670
So the default will be executed only if neither of these cases was executed.
66
00:05:13,680 --> 00:05:20,810
So if one of them was true, that means that the value we received from the user was between one up
67
00:05:20,810 --> 00:05:21,460
to 12.
68
00:05:21,830 --> 00:05:26,810
And in this case we would executed and print the corresponding month name.
69
00:05:27,200 --> 00:05:28,950
But if that's not the case.
70
00:05:28,970 --> 00:05:36,140
OK, so let's say to the user that we got some error and asked him to try again some month between one
71
00:05:36,140 --> 00:05:45,320
to 12, because he probably he or she probably did not use a good some good or a more appropriate number.
72
00:05:46,460 --> 00:05:49,030
So, yeah, this is it for this video.
73
00:05:49,060 --> 00:05:53,090
Let's just build and run in to make sure that everything is working as expected.
74
00:05:53,090 --> 00:05:55,980
So enter the month number on.
75
00:05:56,030 --> 00:05:57,380
Let's go like five.
76
00:05:57,380 --> 00:06:03,910
So it's May and let's go with seven, which is July and let's go with one which is January.
77
00:06:03,920 --> 00:06:04,460
Awesome.
78
00:06:04,740 --> 00:06:07,460
Let's go with some non-trivial number fifteen.
79
00:06:07,730 --> 00:06:09,500
So oh ever try again.
80
00:06:09,500 --> 00:06:11,480
Some months between one to twelve.
81
00:06:11,720 --> 00:06:12,880
And that's awesome.
82
00:06:12,890 --> 00:06:15,740
We also handle this kind of problem.
83
00:06:17,060 --> 00:06:19,550
So yeah guys this is it.
84
00:06:19,550 --> 00:06:20,960
Thank you for your time.
85
00:06:20,960 --> 00:06:26,690
You are now an expert of creating different programs for calendars.
86
00:06:28,340 --> 00:06:28,910
Yeah.
87
00:06:28,910 --> 00:06:31,460
And this is it for this video.
88
00:06:31,460 --> 00:06:34,700
If you still have any questions, feel free to ask them.
89
00:06:34,700 --> 00:06:36,140
My name is Bloodwood Netsky.
90
00:06:36,170 --> 00:06:39,440
This is Alphatech and of course, keep on practicing.
91
00:06:39,440 --> 00:06:45,410
Keep on moving forward with the course and I think you are going to do well.
92
00:06:45,800 --> 00:06:46,970
So until next time.
93
00:06:47,000 --> 00:06:47,780
I'll see you then.
8407
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.