-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathMenu.java
More file actions
41 lines (33 loc) · 1.09 KB
/
Menu.java
File metadata and controls
41 lines (33 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.booleanuk.core;
import java.util.ArrayList;
public class Menu {
private ArrayList<Item> itemsOnMenu;
public Menu(ArrayList<Item> itemsOnMenu){
this.itemsOnMenu = itemsOnMenu;
}
public String seePrice(Item itemToCheck){
for(Item anItem : itemsOnMenu){
if(anItem.getName().equals(itemToCheck.getName())){
return "The item costs: " + itemToCheck.getPrice();
}
}
return "Item dont exist on the menu!";
}
public String showAllFillingsWithCosts(){
String allFillingsWithPrices = "";
for(Item anItem : this.itemsOnMenu){
if(anItem.getTypeOfItem().equals("Filling")){
allFillingsWithPrices += anItem.getName() + ", " + anItem.getPrice() + "$\n";
}
}
return allFillingsWithPrices;
}
public Boolean isContainedInInventory(Item itemToCheck){
for(Item anItem : itemsOnMenu){
if(anItem.getName().equals(itemToCheck.getName())){
return true;
}
}
return false;
}
}