6.11 OOP correction challenge
Hello everyone and welcome to this course, we will correct the last challenge we have put in place. n will start part created class VipCustomer Then we will put the three fields. the name the limit of ... redit and the address is thereafter, we will create the three manufacturers. and finally, we will generate the ... etters. We are not going to generate setters since we are not going to use it in this challenge. So start, ... n will create our Vip Customer class Then we will put the three fields. private The first field is. The ... om then credit limit and email limit and to finish the email we will go back to the challenge. e first constructor and empty and must call the constructor with three parameters and with default values on ... to be generated. the first constructor which is empty and we will generate the constructor with the three parameters has returned ... years our challenge the second constructor must transmit the two values received and adds a default value for ... e third. and the third constructor must save all fields so this is the third constructor that we’ve just done ... t also the first. and then we have to generate the getters. so we’ll do the second builder. Who must ... see Two parameters we will put the mail and the name and as indicated in the challenge the ... onstructor without parameter must put default values for the constructor with Three parameters So this Parenthesis and there ... we will put the three three parameters Value, that is to say the name Bernard Then there is credit limit 300 3,000 ... ar example and then the mail We have that the second constructor with two parameters must have a third parameter ... t it has a default value. so this We will call. The third constructor that has three parameters this ... om comma We will set a default value. 50,000 and for the mail You have to be very vigilant ... put in order. You have to check. The parameter you put Before filling in the arguments and ... to we have the three constructors So we will generate. getter the getters only for the three fields La ... we have the getters. We’re going to run the tests to see if our code functions very well so we’re going to ... re-class a hand. main 02 The we will create a Vip object called customer 01 we will call ... e constructor. Without argument to start Next, we will display the name. we’re going to compile our program and you see ... i this functions correctly so Bernard who corresponds to the name that we put in Call of builder Bernard We are going ... to star there. In our hand and we’ll call. The credit limit plus the email so excuse me. It’s a... ouble here Since our getlimitecredit returns a double. We’ll display them. We’ll compile our program. and ... oir if it works correctly so Bernard, the name the mail and the credit limit that corresponds well to ... a value that we put in our builder with three parameters, these are the default values We will ... use a second test. With the constructor Who has two parameters? So we will create another one. Object customer03 02 ... slate. and we will pass parameters. the first parameter that corresponds to the name the name then the mail Concerning ... e name, we will put. John the mail and there we will display the values. GetNom We go directly to the ... display. In the print then we will display, we will put it on different lines. And to finish there ... imitate credit Now we can compile our program and see if it works properly. As you saw we have ... the no john the mail and the credit limit we have to understand when made when we called ... our builder with parameters, we did not pass. the credit limit and we’ve defaulted to ... our class. we’ve defaulted here. When we made the call from our manufacturer With three parameters So ... up to the two manufacturers work correctly. We’ll do the same for the third manufacturer that has three parameters. The backslash ... allows you to skip a line so we’ll create our third object. and the we will pass 3 parameters so ... the credit limit name and the mail the name we will put. Bob credit limit We change a ... little. 600,000 per email and here we will display the name, the mail and the credit limit on ... will skip a line. the credit limit we can go to the line. the mail Now has compiled our ... program and see if the three constructors functions correctly as you see here the first constructor that we had put the ... name Bernard the mail and the credit limit function correctly the second also and the last one that is the ...third also Bob Credit Limit 600,000 and the email I hope this challenge worked for you. In the ... next course We will continue on others of the Java language. See you soon and thank you for having Perform the challenge.