Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
In this video, we're going to finish up part two.
Task five is to the dispense action, and we have this beautiful document to guide us public boolean
dispense.
Takes two parameters, entero and then spot.
And first, we're going to check if the requested item has a bigger quantity than zero.
So if the item.
At the Rio.
And spot.
It's bigger than zero.
We're going to dispense that item from the vending machine, so we need to decrease its quantity by
one.
Set quantity.
We'll get the current quantity of what we're dispensing.
And minus one.
Then we need to return true to confirm that dispensing the drink was successful.
Otherwise, if there isn't enough of that item to dispense, then we're going to return false.
That's all Task six was to test the action, so inside me, I need to remove all code that comes after
creating the machine object.
I'm going to dispense a Pepsi bottle to the user twice, so I need to call the dispenser twice for the
item at Rosero and spot zero.
Machines that dispense zero zero.
All right, and this should decrease the quantity of the Pepsi item by two.
Let's make sure of that by printing the object.
At Rosero and Spot Zero.
And run your code.
And after selling these are two Pepsis, there's only one left Perfect's.
All right, let's clean up, we need to get ready for part three, so I'm going to remove all the code
that follows creating the machine object.
All right, I'll see you in part three.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.