Recipe and ingredient helper classes
This commit is contained in:
parent
a1ac8a366b
commit
5988b459b4
2 changed files with 31 additions and 0 deletions
16
app/src/main/java/krusty/Ingredient.java
Normal file
16
app/src/main/java/krusty/Ingredient.java
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
package krusty;
|
||||||
|
|
||||||
|
public class Ingredient {
|
||||||
|
public String name, unit;
|
||||||
|
public int amount;
|
||||||
|
|
||||||
|
public Ingredient(String name, int amount, String unit) {
|
||||||
|
this.name = name;
|
||||||
|
this.amount = amount;
|
||||||
|
this.unit = unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s: %d %s", name, amount, unit);
|
||||||
|
}
|
||||||
|
}
|
15
app/src/main/java/krusty/Recipe.java
Normal file
15
app/src/main/java/krusty/Recipe.java
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
package krusty;
|
||||||
|
|
||||||
|
public class Recipe {
|
||||||
|
public String name;
|
||||||
|
public Ingredient ingredients[];
|
||||||
|
|
||||||
|
public Recipe(String name, Ingredient[] ingredients) {
|
||||||
|
this.name = name;
|
||||||
|
this.ingredients = ingredients;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue