You will write a personal recipe manager. Your program will let the user add information about his/her favorite food recipes to the system and use commands to edit, sort or search the information. Your program should be a function named MyFavRecipes which takes no arguments and returns no values.
The recipe manager should be capable of accepting commands. Your function should print out a prompt to indicate that the user can enter a command. Your prompt should be a '$' character. At the prompt the user will type a command followed by a set of arguments for the command. Your function will perform whatever action is indicated by the command, and then your program will print a $ character on a new line in order to let the user know that he/she can type a new command. This process will repeat until the user enters the "Exit" command.
Your program should accept the following commands.
1. AddRecipe: This command indicates that the user wants to enter the information about a recipe into the system. It takes four arguments: the name of the recipe, cooking time (in minutes : 0-100) , level of difficulty (1 the easiest and 5 the hardest), and the key ingredient (e.g. milk and sugar), separated by commas. This command adds the information about the new recipe into the system.
2. PrintRecipe: This command prints all the information about the recipes which have been added to the system. It takes no input arguments. The information about each recipe is printed on a separate line. Each line should have four pieces of information on it: the name of the recipe, cooking time, level of difficulty, and the key ingredient, separated by commas.
3. DeleteRecipe: This command indicates that the user wants to delete the information about a recipe from the system. This command should be followed by one argument, the name of the recipe.
4. SortRecipe: This command indicates that the user wants to view a sorted list of recipes. This command should be followed by one argument, either "Time" or Difficulty. It will print the information about the recipes which have been entered into the system, sorted by their cooking time or level of difficulty indicated by the input argument. The information about each recipe is printed on a separate line. Each line should have four pieces of information on it: the name of the recipe, cooking time, level of difficulty, and the key ingredient, separated by commas.
Keep in mind that sorting should be listed in descending order. In case of ties, the ordering is arbitrary.
5. FindByTime: This command searches for all recipes with cooking time below a given threshold (0 to 100). It should be followed by one argument, cooking time threshold. For each recipe in the system with a cooking time below the threshold,the name of the recipe should be printed on a single line.
6. FindByName: This command searches the system for a recipe with a certain name. The command should be followed by one argument, the name of the recipe. If a recipe with the given name is in the system, all the information about it should be printed on a single line: the name of the recipe, cooking time, level of difficulty, and the key ingredient, separated by commas.
7. FindByIngredient: This command searches the system for a recipe with a certain ingredient. The command should be followed by one argument, the ingredient. If a recipe with the given ingredient exists in the database, all the information about it should be printed on a single line: the name of the recipe, cooking time, level of difficulty, and the key ingredient, separated by commas.
8. Exit: This command should end the program
Example Output
The following output is an example of how your program should respond to commands. The text typed by the user is in bold.
$ AddRecipe Pizza, 35, 3, Cheese
$ AddRecipe Hamburger, 20, 3, Meat
$ AddRecipe Sushi, 45, 5, Seaweed
$ AddRecipe Pancake, 20, 2, Flour
$ PrintRecipe
Pizza, 35, 3, Cheese
Hamburger, 20, 3, Meat
Sushi, 45, 5, Seaweed
Pancake, 20, 2, Flour
$ DeleteRecipe Pancake
$ SortRecipe Difficulty
Sushi, 45, 5, Seaweed
Pizza, 35, 3, Cheese
Hamburger, 20, 3, Meat
$ FindByTime 30
Hamburger, 20, 3, Meat
$ FindByName Pizza
Pizza, 35, 3, Cheese
$ FindByIngredient Meat
Hamburger, 20, 3, Meat
$ Exit
Additional Details