All language subtitles for 003 Solution - Part 2_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
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

Original subtitles

In part two, your challenge was to code the logic to determine the winner so we can jump right into

task four, which tells us to write a function that compares your choice against the computer's choice

to determine the game results.

I already have the function defined for you.

It returns a string.

And it takes two parameters string your choice and string computer choice.

So it's going to use your choice and the computer's choice to determine who won.

Then it's going to return a string that represents the game results for now, the result being returned

as an empty string.

But we're going to update the result according to seven different scenarios that could occur here.

I outlined every scenario where the user wins or loses.

So all you have to do is rewrite each scenario as a condition.

So we're going to start by checking if your choice.

Equals rock.

And the computer's choice.

Equal scissors.

Then you win.

So we're going to set result equal to you win.

That's what's going to get returned.

Then in case that doesn't run, we'll check for the opposite scenario where the computer chooses rock.

In.

You, too.

Scissors.

In which case we're going to set the result equal to you would lose.

So there are five more conditions.

I'm going to leave the rest up to you.

And just fast forward from here.

So at this point, we coded every possible scenario and we're done task for.

So when we call this function, it's going to take your choice and the computer's choice, it's going

to evaluate both values against every single condition.

Then it's going to return a result based on which condition ends up being true.

So we can call this function for main.

And we're going to store the result of the game in a variable results.

All right, before we move to task five, I want to see if the function returns the right results.

So I'm going to print the result in main.

And test my code.

Hmm.

It's a tie.

Let me try again.

I feel like winning.

And I guess I'm just never going to win.

But I like that we now have a fully functional game.

Anyways onwards to Task five.

All right.

So Task five tells us to write a function that prints your choice, the computer's choice and the results.

So we're going to say public static.

The function is void because I don't see anything about a return value.

It's going to be called print result.

And as you can see, it takes three parameters.

String your choice.

Strange computer choice and strange results.

And inside the function, I'm going to print your choice, the computer's choice, and the results.

So I'll just move these.

Over here.

And we're all done.

Congratulations on making it this far and building your second interactive game in Java.

In the next section, we're going to add another skill to our Java toolbox.

The ability to run code in a loop.

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