Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- public class Recipe {
- private String name;
- private int cookingTime;
- private ArrayList<String> ingredients;
- public Recipe(String name, int cookingTime, ArrayList<String> ingredients) {
- this.name = name;
- this.cookingTime = cookingTime;
- this.ingredients = ingredients;
- }
- public String getName() {
- return this.name;
- }
- public int getCookingTime() {
- return this.cookingTime;
- }
- public boolean containsIngredient(String ingredient) {
- if (this.ingredients.contains(ingredient))
- return true;
- else
- return false;
- }
- @Override
- public String toString() {
- return this.getName() + ", cooking time: " + this.getCookingTime();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement