Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I receive an error illegal start of expression starting at public class Ingredient {. How would I fix this error? * * To change this

I receive an error illegal start of expression starting at "public class Ingredient {". How would I fix this error?

*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package SteppingStones;

/**

*

*

*

* @author jennifer.cook_snhu

*

*/

public class SteppingStone2_IngredientCalculator {

/**

*

* @param args the command line arguments

*

*/

public static void main(String[] args) {

public class Ingredient {

private String nameOfIngredient = "";

private int numberCups = 0;

private int numberCaloriesPerCup = 0;

public Ingredient(String nameOfIngredient, int numberCups,

int numberCaloriesPerCup) {

this.nameOfIngredient = nameOfIngredient;

this.numberCups = numberCups;

this.numberCaloriesPerCup = numberCaloriesPerCup;

}

public String getNameOfIngredient() {

return nameOfIngredient;

}

public int getNumberCups() {

return numberCups;

}

public int getNumberCaloriesPerCup() {

return numberCaloriesPerCup;

}

public double getTotalCalories() {

return numberCaloriesPerCup * numberCups;

}

@Override

public String toString() {

return numberCups + " cups of " + nameOfIngredient + ", total Calories: " + getTotalCalories();

}

}

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

What Is A Database And How Do I Use It

Authors: Matt Anniss

1st Edition

1622750799, 978-1622750795

More Books

Students also viewed these Databases questions

Question

What is management growth? What are its factors

Answered: 1 week ago