Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started