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
We're going to have the first auction selling a car.
The requirements state that a dealership can perform two auctions, sell a car and search for one.
So in this lesson, we're going to add the selca action.
Inside the dealership class at a method called sell public, the method is not going to return anything,
but it needs an index parameter so that we know which car to sell.
And selling a car implies that the customer is going to drive away with it, so we'll choose the car
object at the index chosen by the user.
And it needs to drive away.
And after the car gets driven away, we need to remove it from the dealership, so set the car object
that we just sold.
Equal to No.
All right, let's assume a customer came to buy the third Mesud.
I want to stay consistent with my visuals, so we'll make this twenty seventeen.
And now this car is in parking lot, too, so we'll sell it to them.
Call Selca from the dealership object and pass in the index to.
It prints them a happy message and it sells them the car driver runs the selca function, which prints
a friendly message, setting the object at index to to know this frees up a parking space.
And now we have room for another car.
Also, I hope you notice how it's all starting to come together by planning our code around objets fields
and actions, everything just fits together so smoothly.
When I read this code, it's almost like I'm reading a story here.
We have three cars, two Nissans and a Dodge.
There is a dealership that owns all of these cars.
Oh, the dealership just sold one of the cars and after selling the car, it gets driven off.
The code is just so easy to read.
And this is the power of object oriented programming.
It makes your code expressive.
And when your code is this expressive, you don't need to add comments because the code is already as
clear as it's going to get.
In this lesson, you added an action to your dealership class, there is one more action that we need
to add and that is searching for a car.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.