Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I am working on Java coding. My class is IT 511 from SNHU - Object Oriented Programming. I am working on a recipe collection

Hi, I am working on Java coding. My class is IT 511 from SNHU - Object Oriented Programming. I am working on a recipe collection manager and it is saying that I need to have a method for createNewRecipe within my recipe.java code but I already have one and I'm not entirely sure why I cannot get it to process that.

I have attached screenshots for both my method and where I am receiving an error. The error states; 'method createNewRecipe in class RecipeBox cannot be applied to given types;'

image text in transcribedimage text in transcribed
85 9 public static Recipe createNewRecipe () { double totalRecipeCalories = 0.0; 87 ArrayList recipeIngredients = new ArrayList () ; boolean addMoreIngredients = true; Scanner sonr = new Scanner (System. in) ; System. out. println ("Please enter the recipe name: ") ; String recipeName = sonr . nextLine () ; System. out. println ("Please enter the number of servings: ") ; int servings = 0; do { System. out. printIn ("Please enter the ingredient name or type end if you are finished entering 100 String ingredientName = scar . next () ; 101 if (ingredientName . toLowerCase () . equals ("end") ) { 102 addMoreIngredients = false; 103 } else { ingredientName = sonr . next () ; // has user enter ingredient name 105 / recipeIngredients . add (ingredientName) ; // adds ingredient name to recipe ingredient arr 106 107 System. out. printIn ("Please enter the ingredient amount: ") ; 108 float ingredientAmount = sonr . nextFloat () ; 109 110 System. out. println ("Please enter the ingredient Calories: "); 111 int ingredientCalories = sonr . nextInt () ; 112 113 totalRecipeCalories = (ingredientCalories * ingredientAmount) ; //expression to add total 114 115 116 117 } while ( !sonr . next () . equals ("end") ) ; 118 119 Recipe recipel = new Recipe (recipeName, servings, recipeIngredients, totalRecipeCalories) ; 120 121 recipel . printRecipe () ; 122 123 return recipel; 124 125 126 + public void createNewRecipe (Recipe recipel) { . ..3 lines } 17952 4 public static void main (String args) { 53 54 RecipeBox RecipeCollectionManagerDriver = new RecipeBox ( ) ; 55 Scanner menusonr = new Scanner (System. in) ; 56 System. out. println ("Menu\ " + "1. Add Recipe\ " + "2. Print All Recipe Details\ " + "3. Print 58 while (menuSonr . hasNextInt () | | menuScar . hasNextLine () ) { System. out. println ("Menu\ " + "1. Add Recipe\ " + "2. Print All Recipe Details\ " + "3. Print int input = menuscnr . nextInt () ; if (input == 1) { // create recipe 64 65 Recipe recipe = new Recipe ( ) ; RecipeCollectionManagerDriver . createNevRecipe (Recipe . createNewRecipe ()); } else if (input == 2) { // Print all recipe details System. out. println ("Which recipe?\ ") ; String selectedRecipeName = menuSonr . next () ; RecipeCollectionManagerDriver . printAllRecipeDetails (RecipeCollectionManagerDriver . listOfRecip } else if (input == 3) { //print all recipes for (int j = 0; j

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions