-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIngredient.java
More file actions
107 lines (91 loc) · 3.11 KB
/
Ingredient.java
File metadata and controls
107 lines (91 loc) · 3.11 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
public class Ingredient {
// define Ingredients parameters
private String nameIngredient;
@SuppressWarnings("unused")
private int typeIngredient;
// string arrays of potentially score-able Ingredients
public static String[] breads = { "white", "wheat", "rye", "sourdough", "ciabatta", "bagel", "hoagie",
"sesame roll" };
public static String[] mains = { "ham", "turkey", "chicken", "tuna", "egg", "avocado", "pastrami", "salami",
"steak", "meatball" };
public static String[] cheeses = { "american", "swiss", "cheddar", "provolone", "cream cheese", "nacho",
"pepperjack", "mozzarella", "gouda", "brie" };
public static String[] sauces = { "mayo", "mustard", "fish sauce", "ketchup", "ranch dressing", "thousand island",
"special", "tartar", "pesto" };
public static String[] freshies = { "lettuce", "tomato", "sprouts", "onion", "bell pepper", "cucumber", "celery",
"spinach" };
public static String[] pickles = { "pickles", "pepperoncini", "capers", "olives", "caramelized onions",
"banana peppers" };
// strings of Ingredient types from int values
public static String[] ingredTypeName = { "Bread", "Main", "Cheese", "Sauce/condiment", "Fresh Veg.",
"Pickles/Cooked Veg.", "Misc." };
private int amountIngredient; // 0 - 3 (none, lite, reg, lots)
String[] ingredAmount = { "none", "lite", "regular", "lots" };
// keep track of number of ingredients created
private static int numberIngredients = 0;
/**
* construct an Ingredient with just a name
*
* @param nameIngredient
*
*/
public Ingredient(String nameIngredient) {
this.nameIngredient = nameIngredient;
numberIngredients++;
}
/**
* Ingredient constructor with only name and type values
*
* @param nameIngredient
* @param typeIngredient
*/
public Ingredient(String nameIngredient, int typeIngredient) {
this.nameIngredient = nameIngredient;
this.typeIngredient = typeIngredient;
numberIngredients++;
}
/**
* Ingredient constructor with all three values
*
* @param nameIngredient
* @param typeIngredient
* @param amountIngredient
*/
public Ingredient(String nameIngredient, int typeIngredient, int amountIngredient) {
this.nameIngredient = nameIngredient;
this.typeIngredient = typeIngredient;
this.amountIngredient = amountIngredient;
if (this.amountIngredient == 0) {
this.nameIngredient = "";
this.typeIngredient = 0;
}
if (this.amountIngredient > 3) {
this.amountIngredient = 3;
}
numberIngredients++;
}
/**
* Print Ingredient will only print toppings (excludes bread and main types in
* final print out) and should only print amount if Lite or Lots (excludes
* regular amount) should make final sandwich array print out less clunky
*/
public String toString() {
String ingred = "";
if (this.amountIngredient == 1 || this.amountIngredient == 3) {
ingred = this.nameIngredient + "-" + ingredAmount[amountIngredient];
} else
ingred = this.nameIngredient;
return ingred;
}
public String getIngredName() {
return this.nameIngredient;
}
/**
* Ingredient counter
*
* @return
*/
public static int getNumberIngredients() {
return numberIngredients;
}
}