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.