-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRestaurant.java
More file actions
42 lines (40 loc) · 990 Bytes
/
Copy pathRestaurant.java
File metadata and controls
42 lines (40 loc) · 990 Bytes
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
42
import java.util.ArrayList;
public class Restaurant{
static ArrayList<Order> orders= new ArrayList<>();
static ArrayList<Topping> toppings= new ArrayList<>();
static void addOrder(Order order){
orders.add(order);
}
static int orderCount(){
return orders.size();
}
static double priciestOrder(){
//Order priciest= null;
double pricey=0;
for(Order order1: orders){
if(pricey<order1.OrdertotalPrice()){
pricey=order1.OrdertotalPrice();
//priciest= order1;
}
}
return pricey;
}
static void addTopping(Topping topping){
toppings.add(topping);
}
static Topping getTopping(String Topping){
for(Topping topping: toppings){
if(Topping==topping.name){
return topping;
}
}
return null;
}
static void printOrders(){
String printing="";
for(Order order: orders){
printing +=String.format("%s%n\n", order.toString() );
}
System.out.println(printing);
}
}