6.19 OOP Exercice-1

Hello, welcome to this new course, we will perform a challenge. We’re going to make sure that we put into practice everything we’ve learned so far. Before we start, I suggest you pause ... this video And start reading the instruction and then perform the challenge yourself I hope that ... you understood the instruction and that you performed this challenge. Don’t forget that to understand the concept of ... programming is essential We will do step by step so that you can follow this challenge well. Let’s start. I already created the Vehicle and Car classes and I put the owners but also the methods So I ... will rather explain you. The steps to do In the class Vehicle I put the owners plus the getters. And ... the methods and so I perform the manufacturer So to start I put some owner of a vehicle of course, there ... there are many more. In this project, I put the name. Here, size the category. The current speed and ... the direction Then I put the builder. In the constructor we will put the name as argument. The size and ... the category since the current speed of the Vehicle will be zero in the manufacturer, I initialized 0 Similarly ... for the current direction, I initialized to 0 since it will be stopped. Then I created a direction method. if we return to our challenge it is indicated, you must be able to handle the direction. to change ... speed and move But since these are not all cars that have a change of speed ... I’m not going to put the method changed to speed. In our Vehicle class I will only. Put the method ... direction plus depalcer if we return to our vehicle class I create the method direction. Which takes as parameter the ... value of the direction. Then I incremented. Our directional variable Current and in line 23 I make a println of ... the value of our direction Then I created an advanced method. Which we can also call Depalcer as indicate in our ... challenge So will rather rename the name. Refactor name Depalcer Depalcer and in this method we will put in parameter ... the speed. Then the direction of the car and we will say the current speed will be equal. a la ... valeur que on va recevoir dans notre méthode et la direction Actuel Va etes égale à la direction que on va recevoir ... dans notre méthode. then we post. the two directional values Actuelle et vitesseActuelle Then I created a stope method that will ... indianiser the speed valueActuelle has 0 since our Vehicle is stationary I put this method ... in our Vehicle class because all vehicles stop and go depalce Then I generated the getters and setters of our ... class In until the We have. Create the Vehicle class Then the Car class, we’ll do it a little ... later and we put. The properties and methods that correspond to our class Vehicle that’s to say The Method ... Getting Out Drive Door speed and then I put. Manual to indicate whether the car is manual or ... automatic which in boolean and finally, last property is the current gearbox at 1, 2.3 where has 4 and ... then I generated the manufacturer. using super to call the manufacturer of our parent class which is Vehicle Being ... since we already have the name of our vehicle which is the car we will put, we will directly ... put. the name so car We will remove. the parameter String Name Now we have our manufacturer. With the call of ... Manufacturer Vehicle Then in the manufacturer, I initialized the value of the current gearbox to 0 Given ... that the car will be stopped during the creation of another car with the manufacturer in the car, I put ... gearbox since we can change speed So, from there, I created a method Change speed ... which will take as parameter the current speed of the gearbox, will be equal to the current speed ... or to be more understandable We will. Change the name, we’ll put. Gearbox We’ll do this ... That’s our variable here Go are equal. To the value That we will receive Where has the argument that we will receive? In our method change Speed Then we display. The gearbox That the car will have to choose, we will ... change the name of our method changed speed We will put. Change Gearbox It’s going to be more compressible. and here in the print we’re going to change We’re going to put. Change gears Gearbox And here we go. Then change Direction changeVitesse Take the speed of the car and the direction as parameter and call the Depalcer method ... Which is in our mother class Vehicle So, in argument, we will see the speed plus the direction. the... the argument we have the speed plus the direction. We will change. from printLn and there we will put the ... speed. Then I will generate. Getters and setters Now, if we go back to our challenge We have done. The first ... part Which is to create the Vehicle class. the car class that inherits the parent class that is Vehicle ... Now we’re going to move on to this step that finally says create another class a specific type of car that ... inherits the Car class We’re going to continue this step in a next video. SEE YOU SOON.