Stepping Stone Lab One - Pseudocode for Your Program

2-2 Stepping Stone Lab One: Pseudocode for Your Program

Alexander O. DiStefano

IT-511 Object Oriented App Developent11/4/2019

Doctor Neal

Southern New Hampshire University

The program for the final project is a collection manager program for culinary recipes. There will need to be three primary classes in the overall program: The first one will be for storing ingredients to store what items comprise a given recipe. The second will be for the actual recipes which will draw objects from the ingredients class as well as methods that are recipe specific.

The third class will be an array that will store recipes and their components. The user will be able to enter some information, such as the total number of calories in a recipe, but the program will handle other variables automatically. The “Recipe Box” will be the primary aspect which users will interact with and will contain the “main” function of the overall Java program. As such, it will present the following options: Add New Recipe, Add New Ingredient, View Recipe, View Ingredient Details, Print a list of all recipes in storage, Print a list of all ingredients in storage, Delete a recipe, Delete an Ingredient, Exit Program.

The pseudocode below will help to inform the overall flow of the program as the project develops. It has been broken up on a per section/function basis for readability:

Variable Definitions

Ingredients

DEFINE string nameOfIngredientDEFINE double numberOfCupsDEFINE double numberOfCaloriesPerIngredientDEFINE double totalIngredientCalories

DEFINE int totalNumberOfIngredientsDEFINE ingredientList as array

Recipes

DEFINE recipeIngredients as an array list

DEFINE string recipeNameDEFINE int numOfServingsDEFINE double totalRecipeCaloriesRecipe Box

DEFINE recipeBox = recipeListDEFINE recipeList as an array list, void, no members

Main Function in Recipe Box

CALL function recipeBoxIF user selects Add New Recipe

GOTO function addNewRecipeELSE IF user selects Add New Ingredient

GOTO function addNewIngredientELSE IF user selects View Recipe

GOTO function viewRecipeELSE IF user selects View Ingredient Details

GOTO function viewIngredientDetailsELSE IF user selects Print Recipe List

GOTO function printRecipeListELSE IF user selects Print Ingredient List

GOTO function printIngredientListELSE IF user selects Delete a Recipe

GOTO function deleteRecipeELSE IF user selects Delete an Ingredient

GOTO function deleteIngredientELSE IF user selects Exit Program

CLOSE program

END function

Add Recipe

CALL function addRecipeDEFINE scanner object for accepting user input

CALL function getRecipeNameCALL function getNumOfServingsCALL function getRecipeIngredientsDISPLAY all ingredients in program memory

GET user input for ingredients

CALL function totalRecipeCaloriesFOR each ingredient in the recipe

totalRecipeCalories = sum of totalIngredientCaloriesPRINT recipe to recipeList array

END function

Add Ingredient

CALL function addIngredientCALL function getNameOfIngredientCALL function getNumberOfCupsCALL function getNumberOfCaloriesCALL function getTotalIngredientCaloriestotalIngredientCalories = numberOfCups * numberofCaloriesPerIngredientPRINT ingredient to ingredientListEND function

View a Recipe

CALL function viewRecipePRINT a list of all recipe names

IF user selects a specific recipe

PRINT the selected recipe

ELSE IF

RETURN to the home screen of the program

END function

View Ingredient

CALL function viewIngredientDetailsPRINT a list of all ingredient names

IF user selects a specific ingredient

PRINT the details of the selected ingredient

ELSE IF

RETURN to the home screen of the program

END function

List all recipes

CALL function printRecipeListPRINT recipeListIF user selects a specific recipe

PRINT all details

ELSE IF return to the home screen of the program

END function

List all Ingredients

CALL function printIngredientListPRINT ingredientListIF user selects an ingredient

PRINT all details

ELSE IF return to the home screen of the program

END function

Delete a Recipe

CALL function deleteRecipePRINT list of all recipes

IF user selects a recipe

CONFIRM they want to delete it

IF “Yes”

DELETE selected recipe

RETURN to recipe list

ELSE IF “No”

RETURN to recipe list

ELSE IF return to the home screen of the program

END function

Delete an Ingredient

CALL function deleteIngredientPRINT list of all ingredients

IF user selects an ingredient

CONFIRM they want to delete itIF “Yes”

DELETE selected ingredient

RETURN to ingredient list

ELSE IF “No”

RETURN to ingredient list

ELSE IF return to the home screen of the program

END function

Cite this page

Stepping Stone Lab One - Pseudocode for Your Program. (2019, Nov 29). Retrieved from https://paperap.com/stepping-stone-lab-one-pseudocode-for-your-program-best-essay/

Stepping Stone Lab One - Pseudocode for Your Program
Let’s chat?  We're online 24/7