All language subtitles for 013 Pokerito Solution - (Task 1)_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
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
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,520 --> 00:00:05,270 I hope you had fun building poker, Rito, if you had any trouble, no worries in this video. 2 00:00:05,300 --> 00:00:07,820 I'm only going to go through task one because it's very long. 3 00:00:08,240 --> 00:00:12,560 But in the next video, I'm going to go through the remaining tasks so you can choose which video to 4 00:00:12,560 --> 00:00:14,720 watch, depending on where you got stuck. 5 00:00:16,730 --> 00:00:20,090 So your first task was to create a function that returns a random card. 6 00:00:20,120 --> 00:00:22,730 As always, it's going to be public static. 7 00:00:25,460 --> 00:00:26,780 It returns string. 8 00:00:29,030 --> 00:00:31,370 And the name of the function is random card. 9 00:00:33,480 --> 00:00:39,420 It says nothing about parameters, so it's not going to take any and OK, there are 13 cards. 10 00:00:39,420 --> 00:00:43,470 So inside the function, we need to get a random number between one and 13. 11 00:00:44,530 --> 00:00:50,350 So what I'll do is I'll set double a random number is equal to Mathoura Random Times 13. 12 00:00:57,410 --> 00:01:02,190 Remember that math, that random returns a random decimal between zero and less than one. 13 00:01:02,720 --> 00:01:09,050 So if you multiply the result by 13, we can expect a decimal between zero and less than 13. 14 00:01:10,280 --> 00:01:15,730 And in the second line, I'm going to add one to the random number range by setting random number plus 15 00:01:15,740 --> 00:01:16,430 equals one. 16 00:01:17,560 --> 00:01:21,430 And now we should expect the number to be in the range of one to less than 14. 17 00:01:25,900 --> 00:01:30,220 And now we're going to set into equal to that random number, but as an integer as a whole, no. 18 00:01:36,880 --> 00:01:41,410 And so this third line is going to cut off the decimal, which means our random number should now spend 19 00:01:41,410 --> 00:01:43,330 the range of one to 13. 20 00:01:44,500 --> 00:01:49,270 So far, this is nothing new because we did something very similar when we built Paradise Project in 21 00:01:49,270 --> 00:01:50,140 the last section. 22 00:01:52,400 --> 00:01:56,840 So we're done the first part of this function, the second part requires us the return, a card that 23 00:01:56,840 --> 00:01:58,580 matches that random number. 24 00:02:00,630 --> 00:02:06,120 And what you can do is get the string values from the cards, the text file, if you go to card text 25 00:02:06,120 --> 00:02:09,990 in your file Explorer, I left you all 13 cards in the form of a string. 26 00:02:13,450 --> 00:02:18,880 So what we can do is use a switch statement to compare their random number against 13 cases. 27 00:02:57,420 --> 00:03:02,370 And in the event that a random number doesn't match any of our cases, we need to add a default case 28 00:03:02,850 --> 00:03:05,250 because the function expect a string no matter what. 29 00:03:07,380 --> 00:03:11,730 But obviously, this is never going to run because we know that our random number can only go from one 30 00:03:11,730 --> 00:03:12,420 to 13. 31 00:03:14,360 --> 00:03:18,020 In any case, in the event of a case match, we're going to return the right card. 32 00:03:22,990 --> 00:03:27,790 So here we're going to return the card for case one, which would be Ace, I'm going to copy the ace 33 00:03:27,790 --> 00:03:32,620 card to the right of the return key word, and then I can highlight all of this and press tab a few 34 00:03:32,620 --> 00:03:34,210 times and bring this back. 35 00:03:35,350 --> 00:03:37,780 And we just have to keep doing this 13 times. 36 00:03:37,780 --> 00:03:40,390 If you feel like doing it with me, then by all means. 37 00:03:40,810 --> 00:03:44,070 But if you want to skip ahead and fast forward, you can do that as well. 38 00:07:16,350 --> 00:07:20,370 OK, now, even though this is never going to get called, Java doesn't know that and it's going to 39 00:07:20,370 --> 00:07:25,800 give you an error because it's basically telling you, hey, in the event that a random number doesn't 40 00:07:25,800 --> 00:07:31,140 match any of our cases, the default case needs to return a string value as well because the function 41 00:07:31,140 --> 00:07:31,860 demands it. 42 00:07:32,970 --> 00:07:36,900 So I'm going to return this shouldn't get called because they won't. 43 00:07:45,490 --> 00:07:51,100 OK, that's all for task one, we're done, but it's good practice to always test your code before you 44 00:07:51,100 --> 00:07:51,760 write any more. 45 00:07:51,760 --> 00:07:54,820 So I'm going to call the function and print the return value from Main. 46 00:08:01,810 --> 00:08:03,190 OK, I'll run my code. 47 00:08:15,670 --> 00:08:21,040 And it returns a card, I'll know if my function works, if I keep returning a random card every time 48 00:08:21,040 --> 00:08:24,160 I run it, and that is exactly the case. 49 00:08:24,610 --> 00:08:27,550 In the next video, we're going to implement the remaining tasks. 5223

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