diff --git a/src/RecipeInstructions.java b/src/RecipeInstructions.java index 79ebb35..7ad47b6 100644 --- a/src/RecipeInstructions.java +++ b/src/RecipeInstructions.java @@ -20,10 +20,11 @@ public class RecipeInstructions userInstruction = userInput.nextLine(); RecipeCreation(userInstruction,fullInstructions); - fullInstructions.printTree(); - System.out.println(fullInstructions.sortTopology()); - } while(!userInstruction.equalsIgnoreCase("done")); + + + System.out.println(fullInstructions.sortTopology()); + System.out.println("Thank you for using recipe constructor."); } //Magical Regex diff --git a/src/RecipeNode.java b/src/RecipeNode.java index 9f049c5..36d094e 100644 --- a/src/RecipeNode.java +++ b/src/RecipeNode.java @@ -58,6 +58,10 @@ public class RecipeNode { } @Override public String toString() { - return "RecipeNode [ingredient=" + ingredient + ", portion=" + portion + "]"; + if(portion != 0) { + return "[Ingredient: " + ingredient + ", portion = " + portion + " units]"; + } else { + return "[Ingredient: " + ingredient + "]"; + } } } diff --git a/src/RecipeTree.java b/src/RecipeTree.java index f9037bd..b4fa3b7 100644 --- a/src/RecipeTree.java +++ b/src/RecipeTree.java @@ -118,6 +118,10 @@ public class RecipeTree Stack stack = new Stack(); stack.push(root); sortTopology(root, stack); + + for(RecipeNode node : stack) { + System.out.println(node); + } return stack; }