All language subtitles for 12. Challenge 3 - Solution 2

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,070 --> 00:00:00,300 Mark Colvin. 2 00:00:00,560 --> 00:00:02,060 What is going on, guys? 3 00:00:02,090 --> 00:00:05,090 So let's get down to business right away. 4 00:00:05,540 --> 00:00:10,070 We need to create three great variables, grade one grade, too, and grade three. 5 00:00:10,430 --> 00:00:12,980 So for that, we'll use in grade one. 6 00:00:13,640 --> 00:00:13,970 Great. 7 00:00:14,020 --> 00:00:18,320 Two and grade in grade three. 8 00:00:18,320 --> 00:00:19,760 Semicolon at the end. 9 00:00:19,820 --> 00:00:21,090 Control, as we say. 10 00:00:21,350 --> 00:00:27,290 Now, let's print some nice message in which we will ask the user to insert its first grade. 11 00:00:27,650 --> 00:00:34,730 So we'll use something like print F, enter grade one. 12 00:00:35,930 --> 00:00:43,040 And now let's read grade one from the user and put this value inside of variable grade one so we can 13 00:00:43,040 --> 00:00:46,640 do it by using scan F, scan F percentage. 14 00:00:46,640 --> 00:00:53,540 The because we are using we are reading an integer value and we will place it inside of the address 15 00:00:53,570 --> 00:00:56,000 where grade one resides. 16 00:00:56,930 --> 00:00:57,590 All right. 17 00:00:57,650 --> 00:00:58,760 This is good. 18 00:00:58,880 --> 00:01:02,940 Now let's do the same for both the grade two and grade three. 19 00:01:02,960 --> 00:01:03,260 OK. 20 00:01:03,410 --> 00:01:05,570 So copy paste and copy paste. 21 00:01:05,780 --> 00:01:09,140 Print F, enter a grade two and the same here. 22 00:01:09,170 --> 00:01:09,590 Great. 23 00:01:09,670 --> 00:01:15,320 Two in here will enter a grade three and read the grade three. 24 00:01:15,650 --> 00:01:16,220 There you go. 25 00:01:16,520 --> 00:01:21,500 Also, let's define here another variable called average. 26 00:01:21,590 --> 00:01:24,310 And we will set it to be of type double. 27 00:01:24,340 --> 00:01:26,720 So use double average. 28 00:01:27,380 --> 00:01:32,840 This variable should hold the average of the three grades we've just read from the user. 29 00:01:33,000 --> 00:01:33,500 All right. 30 00:01:33,950 --> 00:01:41,210 So at this point, we can basically say that the average of the previous three grades read here on this 31 00:01:41,210 --> 00:01:46,760 line of where we used scan F, the average should be something like that. 32 00:01:46,790 --> 00:01:48,510 Average equals two. 33 00:01:49,080 --> 00:01:50,750 Let's some all of the grades. 34 00:01:50,780 --> 00:01:52,580 So grade one plus. 35 00:01:52,580 --> 00:01:54,780 Grade two plus. 36 00:01:54,830 --> 00:01:56,240 Grade three. 37 00:01:56,790 --> 00:01:57,230 Right. 38 00:01:57,620 --> 00:01:59,750 And just divided by three. 39 00:01:59,870 --> 00:02:01,280 Semicolon at the end. 40 00:02:01,530 --> 00:02:03,740 And now let's think will it work? 41 00:02:04,100 --> 00:02:07,490 I want you to pause the video and take a second to think about it. 42 00:02:07,730 --> 00:02:11,050 So the answer to this question is absolutely no. 43 00:02:11,360 --> 00:02:15,390 Because we've just talked about how important it is to use casting. 44 00:02:15,430 --> 00:02:19,970 To get the exact grade, assuming it may maybe a floating point type. 45 00:02:20,210 --> 00:02:24,230 And we've learned a couple of ways in which we can accomplish that. 46 00:02:24,590 --> 00:02:30,620 So in this example, we can see that on the right side of the equation in line 14. 47 00:02:30,920 --> 00:02:34,970 You can see that both the participants on the right side here. 48 00:02:34,980 --> 00:02:35,290 Right. 49 00:02:35,360 --> 00:02:36,830 Here is the three end. 50 00:02:37,190 --> 00:02:41,120 Also, all of these some both of them are basically integers. 51 00:02:41,390 --> 00:02:47,480 And we know that the result of these mathematical operation, we've said it previously in there in the 52 00:02:47,480 --> 00:02:53,840 video where we discussed casting, the result of that is also going to be of type in nature, meaning 53 00:02:53,870 --> 00:03:00,500 that if we get here on the right side, an average grade of something like eighty five point seven, 54 00:03:00,500 --> 00:03:06,960 if we should get this value, basically it will be just rounded to eighty five. 55 00:03:07,250 --> 00:03:11,180 And then we lose the whole point of using these exercises. 56 00:03:11,480 --> 00:03:13,640 So for that, we need to use casting. 57 00:03:13,970 --> 00:03:17,550 And basically we should simply define one of these. 58 00:03:17,900 --> 00:03:25,220 Or a numerator or denominator to be of type of type double or a floating point type, for example. 59 00:03:25,460 --> 00:03:32,030 So the easiest way to do it when we can simply just add a dot zero at the end. 60 00:03:32,480 --> 00:03:41,330 And what we've basically done here is we simply say that these value, instead of using three, as it 61 00:03:41,330 --> 00:03:48,060 was previously, just an integer, that this value is of ways of a floating point. 62 00:03:48,500 --> 00:03:55,070 And this means that the result of this whole operation, of this whole day vision, of this sum by these 63 00:03:55,130 --> 00:03:59,900 three point zero, the result of eating is also going to be by default. 64 00:04:00,320 --> 00:04:02,860 It's also going to be of a floating point type. 65 00:04:03,050 --> 00:04:05,030 And that's exactly what we want to do. 66 00:04:05,330 --> 00:04:08,900 So let's now print the result, print the average grade. 67 00:04:08,900 --> 00:04:15,710 So print F average equals two percentage left because we use double. 68 00:04:16,130 --> 00:04:19,400 Actually, there is no real Nessus. 69 00:04:19,440 --> 00:04:22,450 Nicest necessity to use double here. 70 00:04:22,460 --> 00:04:24,320 We can basically just use float. 71 00:04:24,350 --> 00:04:26,660 But let's leave it as is for now. 72 00:04:27,020 --> 00:04:32,000 And here we will use the average semicolon at the end here. 73 00:04:32,090 --> 00:04:32,660 All right. 74 00:04:32,870 --> 00:04:34,670 Now let's build and run it. 75 00:04:34,970 --> 00:04:37,130 Oh, and we have a little problem here. 76 00:04:37,130 --> 00:04:43,510 Was the problem in line 14 average equals to grade one plus grade two plus rate. 77 00:04:43,790 --> 00:04:47,720 Oh, I forgot the three here divided by three point zero. 78 00:04:47,870 --> 00:04:48,300 All right. 79 00:04:48,320 --> 00:04:49,400 So now it should be good. 80 00:04:49,460 --> 00:04:51,950 Let's save it and build and run it once again. 81 00:04:52,430 --> 00:04:53,360 There you go. 82 00:04:53,390 --> 00:04:55,280 Here is our consular application. 83 00:04:55,520 --> 00:04:57,940 Now, let's use some example here. 84 00:04:57,980 --> 00:04:59,350 Let's say it was the first. 85 00:04:59,490 --> 00:05:02,460 Wade was 80 and then we had 60. 86 00:05:02,950 --> 00:05:05,870 Then we had, I don't know, ninety five. 87 00:05:06,280 --> 00:05:13,450 So every time you pressed enter, I just just to remind you guys, the number itself you pressed here 88 00:05:13,480 --> 00:05:17,520 was inserted, was placed inside of the corresponding variable. 89 00:05:17,530 --> 00:05:23,290 So in this example we had one and then grey two and then grade three once we pressed the enter right 90 00:05:23,290 --> 00:05:23,550 now. 91 00:05:23,740 --> 00:05:25,390 So let's press that. 92 00:05:25,790 --> 00:05:27,640 And there and there you go. 93 00:05:27,650 --> 00:05:32,380 There is your average grade equals to seventy eight point three three three. 94 00:05:32,740 --> 00:05:36,700 We can limit that by placing here DOT two. 95 00:05:36,940 --> 00:05:42,490 And also, of course, let's add a backslash in the end just to separate separated from the default 96 00:05:42,490 --> 00:05:42,940 text. 97 00:05:43,360 --> 00:05:50,010 Let's build in running once again executes something like 75, 65 and 200. 98 00:05:50,110 --> 00:05:52,760 Let's do it like 97. 99 00:05:53,230 --> 00:05:56,450 Larry, go seventy nine point zero zero. 100 00:05:56,480 --> 00:06:06,310 We'll limited it by putting a DOT two, which simply says you can place just two digits after the floating 101 00:06:06,310 --> 00:06:06,610 point. 102 00:06:06,850 --> 00:06:07,430 All right. 103 00:06:07,450 --> 00:06:10,150 So we almost finished this exercise. 104 00:06:10,240 --> 00:06:13,960 Just one last thing that I want to show you guys in this example. 105 00:06:14,230 --> 00:06:21,250 We can also leave the three, as it was previously, as an integer, and instead we can just think any 106 00:06:21,250 --> 00:06:24,550 of these variables here on the left side. 107 00:06:24,610 --> 00:06:29,240 We can take any of them and just cast them to be of type double. 108 00:06:29,500 --> 00:06:37,120 This basically will be enough for for the whole operation, for the whole math operation to treat it 109 00:06:37,120 --> 00:06:41,560 as a floating point number so we can basically do something like that. 110 00:06:41,890 --> 00:06:49,630 Just add here double casting and now all of your result will be treated as a floating point and it will 111 00:06:49,630 --> 00:06:54,330 work okay without any round to the smallest integer. 112 00:06:54,490 --> 00:06:59,170 You can also do the same for the second for the OP's. 113 00:06:59,230 --> 00:07:00,790 Sorry about that. 114 00:07:01,870 --> 00:07:02,590 There you go. 115 00:07:02,950 --> 00:07:05,380 You can also do it for the second grade. 116 00:07:06,250 --> 00:07:07,300 It doesn't matter. 117 00:07:07,440 --> 00:07:07,730 Okay. 118 00:07:08,050 --> 00:07:15,640 So basically, I hope you've got the idea of how to use casting and you practice it with this nice little 119 00:07:15,640 --> 00:07:17,980 exercise of using three grades. 120 00:07:18,210 --> 00:07:25,120 And actually, yeah, I can say that I think that you're ready to move on to your next milestone. 121 00:07:25,330 --> 00:07:32,290 And actually, the next milestone is very interesting milestone because you will develop in this milestone 122 00:07:32,410 --> 00:07:34,090 a weather station. 10632

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.