All language subtitles for 021 Finalizing the Application_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
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
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
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 lesson, we're going to finalize the application.

The data contains shirts and pants, and you can store each line as an object of the product class,

so I'm going to start by removing this code.

Could a function that returns a product to Ray?

Called Get Data.

And it's going to throw a file not found exception.

All right, now create a new object of the Phalen input stream class.

And the family bitstream is going to connect to products, not text the file name.

And now we can create a new object of the scanner class that's going to pick up the data from the input

stream.

OK, looking back, there are 18 arrows, so we'll need to create a product array that can store 18

objects.

Now, you might think Tikrit a while loop while scandal has next line, but we need a counter that keeps

track of every row so that we can populate the array properly.

So here is a for loop instead.

For it is equal to zero and the loop is going to keep running as long as Sk๏ฟฝne has a next line.

Plus, plus.

OK, great.

Now, looking back at the file, notice that the first piece of data tells us what the object is.

So we'll pick up the first value in that line using Scandi next and put it in a switch statement if

that value happens to be pant's.

We're going to set the element at that index I.

Equal to a new object of the class.

Looking back at the data, we got to pick up an ENT double string string next and.

Next double.

Next.

Next.

If that value happens to be a shirt.

We're going to set that element and index I.

Equal to a new object of the class, looking back at the data, we got to pick up a string, double

string string.

So we'll say next.

Next double.

Next and next.

Now, this gives an error because this constructor doesn't exist.

The constructor expects an item type, but we're passing in a string.

What you can actually do is get an enum value from a string, so from the item size will get the enum

value that corresponds to scan next.

So if scandal next to small, we're going to get back in value of small.

If it's medium, we'll get back medium anyways, that's really a.

And so we populated the products array with shirts and pants, that's polymorphism for you right there,

because each child object is taking the form of its parent.

Now, I'll close scanner.

In return, the product to Ray.

And perfect.

That was the hard part.

Now we get to enjoy the fruits of our labor.

Inside, man, we're going to try to call the get data function and store the result in an array.

And will catch the exception if the code happens to fail.

And will print the exception that it comes with it.

And assuming everything works, you're going to sort the array, every object in that array, we know

implements the comparable interface and so the array is going to be sorted alphabetically and by price

because that's how we designed it.

Now run through every product in the product array and print it.

OK, we'll put a break point here, run the debugger.

Step into the function.

OK, first one, a shirt, so with is a shirt object.

Next one is so a store is a pants object.

And I want to skip the rest.

So I'll put another break point and press next.

Here is our array, fully populated.

We'll keep going now, our Arae got sorted pans show up first.

Shirt after in the array is also sorted based on price, that's perfect, will print it.

And that's kind of ugly.

It wouldn't hurt to touch things up.

Go to shirt that java, remove the brackets, they're not various statically pleasing.

A white shirt in the beginning and put a tab of space before each value.

I think they should look pretty nice.

And I'll do the same thing for Pentz.

I'll give you some time to pause and get that done.

OK, I'll rerun my app.

And beautiful.

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