-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPizza.java
More file actions
63 lines (51 loc) · 1.23 KB
/
Pizza.java
File metadata and controls
63 lines (51 loc) · 1.23 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import java.util.*;
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.31.1.5860.78bb27cc6 modeling language!*/
// line 122 "model.ump"
// line 202 "model.ump"
public class Pizza
{
//------------------------
// MEMBER VARIABLES
//------------------------
List<String> ingredients = new ArrayList<String>(){};
static List<String> toppinngs = new ArrayList<String>(){{
add("pepperoni");
add("cheese");
add("tomatoe");
add("pineapple");
add("mushrooms");
}
};
//Pizza Associations
private Order order;
//------------------------
// CONSTRUCTOR
//------------------------
public Pizza(int t)
{
if(t == toppinngs.size()){
ingredients.addAll(toppinngs);
}else{
Random rand = new Random();
List<Integer> l = new ArrayList<Integer>();
int n = rand.nextInt(5);
for (int i = 0; i< t;i++){
if(!l.contains(n) || l.isEmpty()){
l.add(n);
ingredients.add(toppinngs.get(n));
}
n = rand.nextInt(5);
}
}
}
public Pizza(String[] toppings)
{
for(String ingredient: toppings)
ingredients.add(ingredient);
}
public Pizza(String topping)
{
ingredients.add(topping);
}
}