All language subtitles for 056 Movie Store – Part 5, Tasks 1-3 (Solution)_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

Original subtitles

In this video.

We're going to cover the solution for part five.

Once again, we tie everything together by adding user interactivity.

Task one tells us to make the store object a class variable because we are going to need to access it

from more than one place inside the class.

Task two is to define a function named load movies.

It takes one parameter, the file name that we're going to load movies from and the function is going

to throw a file not found exception.

First thing we're going to do is load contacts from the file name.

We can use a file input stream.

We'll create a new object of the file input stream class and pass into it the file name that we want

to connect to.

The next thing we need to do is read the data from the movies file.

So after connecting to the file will create a new getter object.

And instead of receiving input from the system, it's going to receive input from the input stream.

And then we can use a while loop to read all the data from the file that we're scanning.

The while loop will keep running as long as the file has a next line.

So it should run ten times.

And during each run, we're going to create a new movie object.

But wait.

Each movie is separated by hyphens.

We can't use Scandal.

Next, bigger scandal.

Next picks up the next value delimited by a white space.

In this case, the delimiter is two hyphens.

So during each run, we're going to have to pick up the entire line as one string.

String line is equal to scandal.

Our next line.

Based on the delimiter, we know that each line can split into three strings.

And I told you to research how the split function can be used to split a string into multiple strings.

So I hope you came up with this.

All you got to do is say line, not split.

And we're going to split the line every time there's a pair of hyphens.

If you hover on the method, it returns an array of string values, which we're going to store in an

array called words.

This array is going to contain three elements because we know that the line was split into three words.

The first word we know is the name.

The second word is the format.

And the third is the rating.

A oh rating is a double, but it's being stored as a string.

And your task was to research how to parse a double from a string.

And I hope you found something like this.

We're going to use the wrapper class double.

To pass a double.

From the string at index to.

And splendid.

And once you're done, don't forget to close the scanner object.

And that's it for the load movies function.

We'll go back to the main method we're going to call Load Movie.

And the file we're going to be loading movies from is movies that text.

Once again we get an error because the load movies method can through a file not found exception.

This is a tactics option.

So if you want to call this method, Java is going to force you to try to run the code.

And if the code happens to fail, you need to catch the file, not a found exception.

And we'll just print the message that comes out of it.

Here.

We're going to print.

Movies loaded.

Followed by two lines.

Then we'll print the two string of the store object.

And.

Okay, I want to test everything before moving on.

We write a lot of code and went at a break point right here.

Launch the debugger.

And step into the function.

I'll step over creating the file input stream as well as the scanner object.

The wire loop runs through every line in the movie file injury each run.

We're picking up the entire line.

Then we're splitting the line around every pair of hyphens.

As a result, we get an array with three values.

Then we're using these values to create a new object and add it to the collection of movies.

And you know what?

I'll never get bored of visualizing code.

It's really cool.

Now there are a lot of movies, so I'll start the debugger here.

And that's all for tasks.

One, two and three.

In the next video over an implement task for.

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