7.9 OOP MASTER

Hello everyone, in this video we will create a small application, using the object-oriented programming that we have learned so far. The purpose of the app is to help a fictional company called Bills Burgers manage their hamburger sales process. So the first thing we have to do is create a hamburger class. So we’re going to create a number of fields. We first devour creating the name that will be the name of the hamburger, and then we will add a price, then we will also add the type of bread that will be used. private string name Then private string meat private double price Privetpuis pivate String type of bread We also have some fields that we have to add, but we will first create our builder. So our builder is going to be made up of four fields. We will create some additional fields that will allow us to add an ingredient and its price. So, private String addition Private name double addition Price then, copy and paste Then, we will create a method that will allow us to add an ingredient and its price. The first method will be for the first ingredient the second for the second ingredient. So public void add Hamburger String name double price Inside. Copy the method, then stick And inside. Create another method that will allow us to display the details of the selected hamburger and ingredients and then display their total prices. Public. double detailHamburger. inside we will create a double variable as the hamburgerprix name. . And then we will display The details of the selected hamburger Now, we will do a if to know if adding name is not "null" and if it is not "null" we calculate its total price Then, is different from "null" inside Hamburger price Then, we will display the details of the ingredients. And we’ll do the same for the second ingredient we copy the yew and glue down we’ll just Then, a return. Hamburger price Now we will test our application. We will go to the Main class Create the hamburger object. Hamburger As varibale name "h" Base As sausage meat. Price 3.56 And as a type of white bread Now we will use our method Adding hamburger. Added hamburger 2. As tomato name price 0.27 Then, the 2nd Cheese. And as price 1.13 Finally we will display the total price of our hamburger. We’re gonna need to call our retail method hamburger. We can now launch our application to check if this functions well And as, you can see, we do have the detail of our Ingredients hamburger and the total price. That’s it for this video, in the next video we will create a girl class that will inherit the Hamburger class I tell you next.