Recipe and ingredient helper classes

This commit is contained in:
Imbus 2024-05-03 05:30:29 +02:00
parent a1ac8a366b
commit 5988b459b4
2 changed files with 31 additions and 0 deletions

View 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);
}
}

View 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;
}
}