Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package domain;
- import java.util.ArrayList;
- import java.util.List;
- public class Pizza {
- private String name;
- private double price;
- private List<Ingredient> ingredients;
- public Pizza(String name, double price){
- setName(name);
- setPrice(price);
- ingredients = new ArrayList<Ingredient>();
- }
- public String getName() {
- return name;
- }
- private void setName(String name) {
- this.name = name;
- }
- public double getPrice() {
- return price;
- }
- private void setPrice(double price) {
- this.price = price;
- }
- public void addIngredient(Ingredient ingredient){
- ingredients.add(ingredient);
- }
- public void addIngredients(List<Ingredient> ingredients){
- ingredients.addAll(ingredients);
- }
- public List<Ingredient> getIngredients(){
- return this.ingredients;
- }
- }
Add Comment
Please, Sign In to add comment