All language subtitles for 054 Movie Store – Part 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

This video is going to cover the solution for part three, looking back at the requirement to be classified

as another type of object, the store and the store is identified by the movies that it manages.

A store also has four actions, adding movies, selling them rent and returning them.

We'll start by adding the field, the movie's field is plural, which implies an array of movie objects,

but once again, we need to use an array list because the number of elements can change, movies can

be added and they can be removed.

And always if a class has fields, you need to apply the big three steps.

We need to add a constructor, a getter and a setter.

The constructor is public shares the same name as the class and it receives no parameters.

Because in the beginning, the list of movies should be empty.

We're just going to set the field equal to a new array list.

That can store movie objects.

Now we want to add a getter that receives one parameter.

The index of the movie object that they're trying to access, and this Geter is going to return a new

copy.

Of the movie Object at the requested index.

Now we want at a Seder that receives two parameters.

The index of the element you want to updates and a movie object that we're going to update the element

with, then we're going to set the element at the requested index.

Equal to a new copy of the movie Object being passed on.

OK, that's all for the Big Three Steps now we're going to add actions.

One action that the store can perform is at a movie to its collection, I'll create a void method named

ad movie receives one parameter, a movie object.

And inside the contacts array list, we're going to add a new copy of the movie Object Being Pastan.

OK, the next action that it can perform is telemovie, the method is Void, called Sell Movie.

And it receives one parameter, the name of the movie you want to sell.

So what we'll do is credit for a loop that runs through the size of the array list.

Remember, that array lists have a size knot length.

And inside the fur loop, we're going to get the movie object at every index I.

We'll get the name failed of that movie and we'll check if it equals the name of the movie, that was

Pastan.

And if that's the case.

Then we're going to remove the movie from their list.

We'll do the same thing for that movie.

It's also void.

And it receives one parameter, the name of the movie you want to rent.

And once again, we'll need another for a loop that runs through the size of the array list, and then

we need to get the movie object that every index I.

Get the name field of that movie.

And we'll check if it equals the name of the movie that was Pastan.

Wait a second.

The code that I'm writing now in this method is identical to the code that I wrote in cell movie.

And if you think about it, even the signature is identical, they're both void and they receive the

same parameter.

And guess what, the code for returning a movie is also going to be identical.

So instead of having three functions that are doing the exact same thing.

We're going to create one function that's void.

Named action, the first parameter is going to be name because all three methods are going to require

a name and the second parameter is a string that represents the type of action they want to perform.

Once again, will create a for loop that runs through the size of the array list.

We're going to get the movie object that every index I.

We'll get the name filled of that movie.

And we'll check if it equals the name of the movie that was Pastan.

And if this condition is true, what we do is going to depend on the action parameter, so here I'll

create a switch statement that runs against a list of cases.

If the cases sell.

Then we're going to remove the movie from the collection.

If the case is rent.

Then we're going to set the availability of that movie to false.

And if the cases return.

Then we're going to set the availability of that movie to trip.

Don't forget to add the keyword at the end of each case.

Kate, now our final task before we can test our code is that a two string method that returns a nicely

formatted string of every movie in the array list, as always, public string to string.

I'll create a string named temp for a temporary.

It's going to be an empty string for now, when we return, it's.

First will create a loop that runs through the size of the array list.

And during each run, I'm going to get the two string of the movie object at the index eye and add the

string to the temp variable that we're returning.

And after adding the two string of the movie, we can add two lines so that we can separate it from

the next two string they got to Pastan.

And that's it now we got to test our code inside main kryten object of the store class.

And the store is going to start by adding three movies, I'm going to use the values from the article.

Store, ad movie.

I'll add the first one, The Shawshank Redemption.

And I'm going to copy this format for the two other movies.

And now we can just print the story.

And good returns, a nicely formatted string of every movie in the movie store, so the ad action works.

Now I'm going to test the cell action.

I'm going to sell The Godfather.

And Perfect's, after selling The Godfather, it gets removed from our collection.

Now I'm going to rent out The Shawshank Redemption.

We run the code.

And The Shawshank Redemption is not in stock anymore.

Beautiful.

That is all for part three.

I'll see you in part for.

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