[Solved] Recipe Wrangler

$25

File Name: Recipe_Wrangler.zip
File Size: 141.3 KB

SKU: [Solved] Recipe Wrangler Category: Tag:
5/5 - (1 vote)

Recipe.javaRecipeList.javaRecipeTester.java

RecipeWrangler.javaFor this program you will maintain a database system for storing and retrieving recipes. Each recipe has a name, a list of ingredients, and instructions. The program adds recipes from a file at the start and then allows the user to add and edit recipes. The program user is able to list the available recipe names and display the information about a specific recipe. When the program starts, the user is asked for recipe file and the program loads all recipes found in the file. When the program ends, the user is asked for a filename to write (save) all recipes. The save overwrites the file if it already exists.We provide a sample recipes.txt file to get you started, but you can create your own recipe file using a text editor (Eclipse can edit text files) or using your program once you implement the Add recipe and Exit (and save to file) options. The required file format is describe later.Welcome messageRecipeWrangler is the main class and it contains the main method that gets the program going. It displays the program welcome message and starts the main menu loop as described below.Recipe Wrangler 2015Let us help you keep track of your favorite recipes.The Main Menu loopThe main menu includes options for maintaining the database (list) of recipes. There is no remove recipe option. Each option is outlined here. Your program must implement each option according to its specification.Main Menu1. Display recipe names (sorted)2. Display/Edit/Add a recipe3. Load recipes from a file4. Save recipes to a file5. ExitEnter choice:1. Display recipe names (sorted)Display a list of the names of the recipes. If no recipes have been loaded from a file or entered by the user, disp the message: No recipesMain Menu1. Display recipe names (sorted)2. Display/Edit/Add a recipe3. Load recipes from a file4. Save recipes to a file5. ExitEnter choice: 1No recipesDisplay a list of the names of the recipes. Keep the recipes in order sorted by name.Main Menu1. Display recipe names (sorted)2. Display/Edit/Add a recipe3. Load recipes from a file4. Save recipes to a file5. ExitEnter choice: 1CEREALCHOCOLATE CHIP COOKIESPANCAKESPESTO2. Display/Edit/Add a recipeDisplay recipe and allow user to replace ingredients or instructions if the recipe name exists in the recipe list. If a recipe with that name is not found in the recipe list, prompt the user for ingredients and instruction, create the recipe instance and add it to the list of recipes.Pseudocode for how to handle Display/Edit/New process array or lietPrompt the user for a recipe name.Convert the name to all CAPS.Get a recipe with that name from the database (if there is one).If there is no recipe with that nameAsk user for the recipes ingredients(newline means the end of the ingredients)Ask the user for the recipes instructions(newline means the end of the instructions)Create an instance of the Recipe (name,ingredients,instructions)Add the new recipe to the list of recipesSort the recipe list(Make Recipe class implement java.lang.Comparable If there is a recipe with that nameDisplay the recipes name, ingredients, and instructions.Display the edit recipe menuGet the users edit menu choiceIf user selects 1Get a new list of ingredientsReplace the ingredients of the recipe with the new listIf user selects 2Get the new instructionsReplace the instructions of the recipe with the new onesIf user selects 3 (or any other input)Exit the edit recipe menuNote: Do convert the name to all upper case letters before saving it as part of recipe. Otherwise, leave each field just it is entered by the user.3. Load recipes from a fileUse a Scanner to read data from a file that contains recipe information. The file format is as follows:Line 1: the number of recipes in the file (will be an integer value)Line 2: name of first recipeLine 3: ingredients for first recipeLine 4: insructions for first recipeLine 5: name of second recipeLine 6: ingredients for second recipeLine 7: insructions for second recipe (3 lines per recipe)Example recipes file contents:4Chocolate chip cookiesflour, sugar, oil, butter, vanilla, chocolate chipsmix all ingredients, make cookies, bake 10 min at 350 degreesPesto1 C basil, 1/2 C parmesan cheese, 1/3 C olive oil, 1/4 C walnuts, 1 clove garlic, salt and pepper to tastemix all ingredients except cheese in a food processor, chop for 1 minute, add cheese and enjoyPANCAKESflour, eggs, milk, baking powder, salt, cooking oilmix all ingredients (except oil), add oil to skillet, pour batter for each pancake, cook one side then flip when bubbles appearCREPE2 eggs, 1C flour, 1/2 C milk, 1/2 C water, 1/2 t salt, 2 T butterwhisk flour, salt, and eggs; add milk and water; pour 1/4 C in small oiled skillet and coat bottom with batter, cook until light brown (~2 minutes) and flip.Create a Scanner connected to the data fileRead the first line of the file and parse as an int value (number of recipes).For each recipe in the file:Get the next line and save it as name (save as upper case)Search programs recipe list for a recipe with this nameIf a recipe with same name is found, get it:Scan next line and save it as ingredientsReplace the ingredients for this Recipe with ingredientsScan next line and save it as insructionsReplace the instructions for the found Recipe with instructionsClose scanner connected to the input file4. Save recipes to a fileWrites all recipes in the program to a file in aphabetical order (by name).Create a PrintWriter connected to the output file nameWrite the number (as an int value) of recipes as the first line of the file.For each recipe in the file:Write the name of the recipe (write name as upper case and on its own line)Write the ingredient list for the recipe and a newline characterWrite the instruction list for the recipeClose the printwriter connected to the input file5. ExitDisplay the exit message: Thanks for using RecipeWrangler!5. ExitThanks for using RecipeWrangler!

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Recipe Wrangler
$25