6.6 OOP challenge-1

Hello, in this course, we will correct the last challenge we have put in place. We’re going to do it ... together, we’re going to do it step by step. At first created our class. SimpleCalculator J'ai déjà ... créé un paquage on va effectuer notre challenge dans, on va créer notre classe dans le paquage calculatrice SimpleCalculaor Nous ... avons notre classe ici. We’re going to go back and forth in our challenge file. So after we do that, we have to...create two fields, that is, two variables. FirstNumber and secondeNumber which are of double type so we will create its variables. private double firstNumber point comma private double Second Number on va retourner dans notre challenge I’m going to put the F ... in uppercase. First in the next step is to create the methods. our first method is get FirstNumber without ... parameter it must return the value of the FirstNumber field so the variable we just created The second is getSeconde ... Number without parameter, it must return us the value of the SecondeNUmber field these are the getters and setter that we ... performed in the previous course I’ll show you a simpler way to generate.. getters and setters ... but first of all our challenge, we go getters first. you right click. Generate getter we can ... also do the getters and setter, but by following the steps of our challenge, we will first do the getters. Here, you choose the two Here, we have the getter of our FirstNumber and the getter of our SecondeNumber on ... will return to the challenge. As it is specified no parameter for the second getter and it must return to us ... the SecondeNumbe field value That’s right. no parameters and it returns to us. Second Number just I made a ... mistake on this rating and it should also be put. in the return and also in the getter and well ... on if you come to make mistakes of this type you can delete everything. and regenerate to be sure ... that there is no problem will return to the challenge and follow the remaining steps The next method ... to create is set FirstNumber with a parameter of the double type that defines the value of the firstNumber field on will ... return to our class we can of course generate it. Generate setter FirstNumber as a parameter, you see that there is ... double. first number as shown in. challenge With a double parameter type. to set a value of the ... firstNumber field. Of course you can put this. As in the course well specified in the new version of Java ... You can not put it, but better to put it. We’re going back to the challenge. Next method is ... setSecondeNumber with a parameter of the double type it must set the value of the SecondeNumber field. It is also a setter of ... our . SecondeNumber, we will automatically generate it setter secondeNumber and don’t forget to put this also we return ... in the challenge there we must have a method named getAddiction result. without parameter it must return the result of ... the addiction of values. from the FirstNumber and SecondeNumber field we will copy getAddictionresult, we return to our public double method on ... will return a double get getAddictionresult for are on me check. getAddictionResult Do not take any parameter. We will create ... a variable. double result that will be equal to the addiction firstNumber and SecondeNumber so firstNumber plus SecondeNumber There, we will ... return result. and of course, we could have done get. firstNumber plus get SecondeNumber Now the next step is going to be. Subtraction Method getMultiplication and getDivision we will do its So SecondeNumber, we will automatically generate it setter secondeNumber and don’t forget to put this also we return ... in the challenge there we must have a method named getAddiction result. without parameter it must return the result of ... the addiction of values. from the FirstNumber and SecondeNumber field we will copy getAddictionresult, we return to our public double method on ... will return a double get getAddictionresult for are on me check. getAddictionResult Do not take any parameter. We will create ... a variable. double result that will be equal to the addiction firstNumber and SecondeNumber so firstNumber plus SecondeNumber There, we will ... return result. and of course, we could have done get. firstNumber plus get SecondeNumber Now the next step is going to be. Subtraction Method getMultiplication and getDivision we will do its So the first public method double getSoustraction that takes no ... parameter that will return it. I’ll put 0 for now and then there’s the public getMultiplication method ... double getMultiplication which will also return us a value, I’ll put 0 for now. and to finish getDivsion public ... double getDivsion without parameter it will return. a value so we start the subtraction. We will create a variable ... double result Equal to FirstNumber minus secondNumber in the multiplication jje will show you another way. to return a ... value we can do firstNumber Multiplier part secondeNumber and there it will return the result in double since here... we have a value, we have a return of double Similar firstNumber Divide part secondeNumber Now, that we have all the ... methods. In the next course, we will continue on this challenge. and perform tests to see if our Challenge ... functions correctly.