Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,390 --> 00:00:04,920
All right, so now let's take a look at how it can be done in our programming language.
2
00:00:05,070 --> 00:00:08,640
So first of all, let's start with all the formality.
3
00:00:08,850 --> 00:00:14,320
Just include everything that you need, then create the main function in Maine.
4
00:00:14,700 --> 00:00:16,230
Open up the curly brackets.
5
00:00:16,740 --> 00:00:22,230
And now let's create a variable that should hold the value of your grade.
6
00:00:22,590 --> 00:00:24,570
So just use it.
7
00:00:24,620 --> 00:00:25,050
Great.
8
00:00:25,110 --> 00:00:25,490
All right.
9
00:00:25,500 --> 00:00:29,770
We all assume that in this example, grade is going to be of an integer type.
10
00:00:30,060 --> 00:00:34,470
Then we are going to read the grade from the user by using the scanner function.
11
00:00:34,500 --> 00:00:41,460
But before that, we are going to print just some guiding message to show the user what we want him
12
00:00:41,460 --> 00:00:42,030
to do.
13
00:00:42,090 --> 00:00:44,610
So print F and enter your grade.
14
00:00:45,060 --> 00:00:52,830
Then we have the scanner function that takes an integer value from the console and put it inside of
15
00:00:52,830 --> 00:00:54,450
the grade variable.
16
00:00:54,540 --> 00:00:57,630
Now we want to check if the grade is real good.
17
00:00:57,900 --> 00:01:02,220
For example, if it is 80 or higher, like we've seen the previous example.
18
00:01:02,550 --> 00:01:05,310
So we just use the condition, the youth condition.
19
00:01:05,400 --> 00:01:09,260
If grade is greater or equals to 80.
20
00:01:09,660 --> 00:01:14,080
And if that's the case, if that's the case, we should print an excellent job message.
21
00:01:14,100 --> 00:01:16,380
So we just go with the print F.
22
00:01:16,710 --> 00:01:17,580
Excellent job.
23
00:01:18,030 --> 00:01:18,600
Backslash.
24
00:01:19,170 --> 00:01:23,730
And at the end of it and we are done with this result.
25
00:01:23,800 --> 00:01:28,920
If the result is true, then the message is an excellent job printed to the screen.
26
00:01:29,070 --> 00:01:32,490
Otherwise mean give the grade is less than 80.
27
00:01:32,760 --> 00:01:36,540
We know that there are two messages that may be printed.
28
00:01:36,630 --> 00:01:37,060
All right.
29
00:01:37,080 --> 00:01:41,870
So the first one would be if the grade is less than 80.
30
00:01:41,910 --> 00:01:45,910
But still, we want to check if it's above 60.
31
00:01:46,050 --> 00:01:47,430
If it's 60 or higher.
32
00:01:47,460 --> 00:01:47,790
Right.
33
00:01:47,880 --> 00:01:56,250
So for that, we're going to use another if statement and master if and check out another condition
34
00:01:56,280 --> 00:01:59,910
if graded equals or greater than 60.
35
00:02:00,000 --> 00:02:03,120
So we have the result for this condition happens to be true.
36
00:02:03,420 --> 00:02:08,250
That means that the grade is somewhere between 60 to 80.
37
00:02:08,250 --> 00:02:08,640
Right.
38
00:02:08,670 --> 00:02:13,680
It's pretty much in this range, which is still okay for our exam.
39
00:02:14,460 --> 00:02:19,500
And if that's the case, we're going to print not bad message to the screen.
40
00:02:19,640 --> 00:02:26,460
But if the result for this condition happens also to be false, then we can say that you failed the
41
00:02:26,460 --> 00:02:29,090
test and you got less than 60.
42
00:02:29,100 --> 00:02:31,770
So we use the title at the last.
43
00:02:31,890 --> 00:02:33,450
Else, let's call it this way.
44
00:02:33,870 --> 00:02:36,620
And what message should we print in this case?
45
00:02:36,800 --> 00:02:41,280
And in this case, we should simply use a no.
46
00:02:41,280 --> 00:02:45,740
You didn't pass the exam and try your best next time.
47
00:02:45,750 --> 00:02:46,230
All right.
48
00:02:46,560 --> 00:02:48,330
Just pretty much a failed.
49
00:02:48,360 --> 00:02:49,620
Try again message.
50
00:02:49,740 --> 00:02:56,790
So this line, these last print f command will only be executed if the grade is not equal or greater
51
00:02:56,790 --> 00:03:05,500
than 60, as well as if it's not greater error or equals to 60 to 80 and to 60, I'm sorry, to 80 and
52
00:03:05,500 --> 00:03:06,090
to 60.
53
00:03:06,210 --> 00:03:13,440
Meaning that this line, these last print F command is going only to be executed if the grade is less
54
00:03:13,530 --> 00:03:14,550
than 60.
55
00:03:14,880 --> 00:03:21,420
And the second print F command, where we can see that a not bad message is printed out of the screen,
56
00:03:21,710 --> 00:03:27,270
is going to be executed when the grade is in the range between 60 to 80.
57
00:03:27,270 --> 00:03:35,640
And the first message is only if you studied well for your exam and you got a grade that is 80 or higher.
58
00:03:35,740 --> 00:03:36,270
All right.
59
00:03:36,330 --> 00:03:38,220
So I hope that makes sense to you.
60
00:03:38,220 --> 00:03:44,520
All this structure, all of this usage of nested if conditions.
61
00:03:44,670 --> 00:03:51,240
And lastly, what I want you to do for this exercise, for these video bitterer say, is that I want
62
00:03:51,240 --> 00:03:57,540
you I would like you to give it a try to solve the above example on your own.
63
00:03:57,630 --> 00:03:58,110
All right.
64
00:03:58,410 --> 00:04:01,380
Just let yourself feel the coding process.
65
00:04:01,410 --> 00:04:03,480
Check out if you've got any errors.
66
00:04:03,750 --> 00:04:07,430
Try to fix them, try to fix them on your own computer.
67
00:04:07,430 --> 00:04:10,560
And the results with what you can see right now on the screen.
68
00:04:10,860 --> 00:04:18,580
But this process, this process of learning, and it's basically will sharpen your skills in programming.
69
00:04:18,640 --> 00:04:19,590
And you need it.
70
00:04:20,130 --> 00:04:21,930
So make sure to check that out.
71
00:04:22,320 --> 00:04:23,670
Give it a shot on your own.
72
00:04:23,820 --> 00:04:26,050
And I'll see you in the next video, guys.
6348
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.