All language subtitles for 046 Contacts – Part 4 (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 Download
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
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,490 --> 00:00:04,980 This video is going to cover the solution for part four, looking back at the requirements be classified, 2 00:00:04,990 --> 00:00:10,870 another type of object, the contact manager and the contact manager as identified by the contacts that 3 00:00:10,870 --> 00:00:11,650 it manages. 4 00:00:11,650 --> 00:00:14,590 And it has two actions, adding and removing contacts. 5 00:00:15,230 --> 00:00:16,750 We'll start by adding the contacts. 6 00:00:16,750 --> 00:00:21,040 Field contact is plural, so it implies an array of Carra objects. 7 00:00:21,460 --> 00:00:25,510 But we're going to use an array list because the number of elements can change. 8 00:00:30,750 --> 00:00:35,190 As always of a class has failed, you need to apply the big three steps, we need to take instructor 9 00:00:35,190 --> 00:00:36,150 at Getter and Setter. 10 00:00:36,630 --> 00:00:42,150 The instructor is public shares the same name as the class, and it's going to receive no parameters 11 00:00:42,870 --> 00:00:45,870 because in the beginning, the list of contacts is going to be empty. 12 00:00:46,470 --> 00:00:51,060 We're just going to set the field equal to a new area list that can store contact objects. 13 00:01:00,920 --> 00:01:04,640 Next, we want to get her gut contact that receives a one parameter. 14 00:01:09,890 --> 00:01:12,980 The index of the contact object that they're trying to access. 15 00:01:15,940 --> 00:01:19,360 In this letter is going to return a new copy of the contact object. 16 00:01:22,790 --> 00:01:24,380 At the request, that index. 17 00:01:26,990 --> 00:01:29,990 Next, we want to add a Seder that receives two parameters. 18 00:01:34,360 --> 00:01:37,630 Contact object that you're going to use to update one of your Helmut's. 19 00:01:40,340 --> 00:01:42,860 The index of the element that you want to update. 20 00:01:45,870 --> 00:01:48,870 Then we're going to set the element at the requested index. 21 00:01:54,860 --> 00:01:58,250 And set it equal to a new copy of the object being Pastan. 22 00:02:05,130 --> 00:02:06,960 OK, that's all for the Big Three Steps. 23 00:02:08,150 --> 00:02:11,390 Now we're going to get the method and contact, it's going to be void. 24 00:02:15,150 --> 00:02:18,750 Receives one parameter, the contact they are trying to add. 25 00:02:21,110 --> 00:02:25,340 And inside, we're going to insert a new copy of the contact object being Pastan. 26 00:02:34,030 --> 00:02:37,240 The next action removes contact is also going to be void. 27 00:02:40,660 --> 00:02:44,320 But it receives one parameter, the name of the contact that you want to remove. 28 00:02:46,770 --> 00:02:50,760 So what we'll do is create a for loop that runs through the size of the array list. 29 00:02:54,060 --> 00:02:58,920 Remember that array, less of a size, not a length and inside the loop. 30 00:02:58,950 --> 00:03:01,680 We're going to get the contact object that every index I. 31 00:03:05,410 --> 00:03:10,300 We'll get the name field of the contact and we'll check if it equals the name that was passed PASTAN 32 00:03:10,900 --> 00:03:15,130 and if that's the case, then we're going to remove that contact from the aerialists. 33 00:03:22,150 --> 00:03:22,840 Perfect. 34 00:03:23,440 --> 00:03:28,000 We're done adding the big three steps, we added the two actions, the last thing we got to do is add 35 00:03:28,000 --> 00:03:28,930 a two string method. 36 00:03:31,860 --> 00:03:34,230 As always, public string to string. 37 00:03:38,270 --> 00:03:43,280 I'm going to create a string named temp for a temporary it's going to be an empty string for now and 38 00:03:43,280 --> 00:03:44,150 we'll return it's. 39 00:03:50,850 --> 00:03:54,330 First will create a for loop that runs through the size of the aerialists. 40 00:04:01,920 --> 00:04:06,540 And during each run, I'm going to get the two string of the contact object at the index I. 41 00:04:12,060 --> 00:04:15,150 And then when I add that strength to the temp variable that we're returning. 42 00:04:16,709 --> 00:04:21,209 And after adding the two string of a contact, we can add two lines so that we can separate it from 43 00:04:21,209 --> 00:04:23,270 the next two string that gets passed into it. 44 00:04:30,950 --> 00:04:33,080 And that's it now we're going to test our code. 45 00:04:35,500 --> 00:04:39,310 Inside the workbook, I left you some values for objects that I want you to create. 46 00:04:47,000 --> 00:04:50,060 First all, create an object of the contact manager class. 47 00:04:57,540 --> 00:05:01,800 Manager is equal to a new object of the contact manager class. 48 00:05:09,740 --> 00:05:14,150 And for the sake of expediency, I'm going to call that contact three times. 49 00:05:27,940 --> 00:05:29,020 Once for Ryan. 50 00:05:49,220 --> 00:05:49,940 Joe. 51 00:05:59,560 --> 00:06:00,610 And Thomas. 52 00:06:23,060 --> 00:06:25,280 Finally, we can print the contact to manager. 53 00:06:29,060 --> 00:06:34,040 By printing the contract to manage our Java internally calls the two string method, which is going 54 00:06:34,040 --> 00:06:37,850 to return a nicely formatted string of every contact and the contact lists. 55 00:06:42,790 --> 00:06:43,300 Beautiful. 56 00:06:46,250 --> 00:06:47,630 So the adduction works. 57 00:06:48,820 --> 00:06:53,290 Now we're going to test the remove action, I'm going to remove the contact name Geo. 58 00:06:57,130 --> 00:06:58,030 We run the up. 59 00:07:02,540 --> 00:07:03,950 And everything works well. 60 00:07:05,910 --> 00:07:07,980 This is the solution for part four. 5876

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