Hellboyandso

domain_Pizza.java

Nov 28th, 2016
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. package domain;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. public class Pizza {
  7.    
  8.     private String name;
  9.     private double price;
  10.     private List<Ingredient> ingredients;
  11.    
  12.     public Pizza(String name, double price){
  13.         setName(name);
  14.         setPrice(price);
  15.         ingredients = new ArrayList<Ingredient>();
  16.     }
  17.    
  18.     public String getName() {
  19.         return name;
  20.     }
  21.  
  22.     private void setName(String name) {
  23.         this.name = name;
  24.     }
  25.  
  26.     public double getPrice() {
  27.         return price;
  28.     }
  29.  
  30.     private void setPrice(double price) {
  31.         this.price = price;
  32.     }
  33.    
  34.     public void addIngredient(Ingredient ingredient){
  35.         ingredients.add(ingredient);
  36.     }
  37.    
  38.     public void addIngredients(List<Ingredient> ingredients){
  39.         ingredients.addAll(ingredients);
  40.     }
  41.    
  42.     public List<Ingredient> getIngredients(){
  43.         return this.ingredients;
  44.     }
  45. }
Add Comment
Please, Sign In to add comment