All language subtitles for 034 Dealership Workbook – Part 1 (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

The goal of this workbook is the quality control, the car and dealership classes.

Because if you're on the out the way it is.

Both cars have negative price values and blank values, and these values don't make any sense and the

color should be forbidden from passing them.

So in the car constructor going to throw an illegal argument exception if the price is less than zero.

Throw a new illegal argument, exception.

Price cannot be less than zero.

We're going to throw another exception if the make is no blank, if you make is equal to no or if the

make is blank.

Throw new.

A legal argument, exception.

Make cannot be null or blank.

And if you rerun the code.

The first checkpoint crashes the app, the price cannot be less than zero, so we need to pass a valid

price values into the constructor.

And the second checkpoint crashes, the app make cannot be null or blank.

Pass valid, make values into the constructor, I'm going to put Nissan and Toyota.

And by this point, the caller has been forced to pass incorrect values into the constructor.

And so if you rerun the code, the second car's value still doesn't make any sense.

The center is another place where quality control needs to take place.

So inside set make I'm going to throw another illegal argument, exception, if the caller passes and

make that is blank or null.

There are new.

A legal argument, exception.

Make cannot be null or blank.

Rerun the code and now the checkpoint and set may crash the app, it forces the color you to pass a

valid make value to the set, make setar the stooges that.

OK, good, but clearly the price setter is another place that needs quality control.

So inside set price, I'm going to say if price is less than zero.

Then I'll throw a new illegal argument exception.

Price cannot be less than zero.

Rerun the code.

And now the checkpoint and set price crashes.

The app, it forces the caller to pass a valid price value to the set price setter.

I run the code again.

And beautiful.

Now we need to investigate the dealership class, so inside the class, there is no need to throw a

legal argument, exceptions anywhere.

Worst thing that could happen is someone could pass on a knowledge of the instructor, but the app would

already throw a null pointer exception.

The same can be said for said car.

But what if the caller passes an invalid index here?

Well, the code would already throw an array index out of bounds exception, so you throwing another

unchecked exception wouldn't make any sense.

What about an illegal state exception?

Well, let me ask you this, does that make sense for a dealership to call the sale method if there

are no cars inside?

Absolutely not.

So if the dealership is empty, then it's not in a valid state to call the sale method.

So what I'm going to do is create a separate method called exempting.

And it's going to loop through the array.

And if any of the objects is not known.

Then you're going to return false and break the loop.

Otherwise, if they all end up being null, then the dealership is empty and will return true.

And now back here, I can say if this if the current object that's calling this method is empty.

Then throw an illegal state exception.

Canacol sell when dealership is empty.

And that's all you had to checkpoints to the car dealership classes, and now each checkpoint forces

the caller to invoke the methods and constructors properly.

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