Here is my code for my Ingredient class:
public class Ingredient {
/* Attribute declarations */
private String name; // name
private int calorieCount; //calorie count
/* Constructor */
public Ingredient(String name, int calorieCount) {
this.name = name;
this.calorieCount = calorieCount;
}
public String getName(){
return name;
}
public int getCalorieCount(){
return calorieCount;
}
public static void main (String[] args)
{
Ingredient item1 = new Ingredient ("Butter", "100");
System.out.println(item1);
}
}
When I try and run it, I get a compiler error:
1 error found:
File: C:\eclipse\workspace\Assignment NEW1\Ingredient.java [line: 28]
Error: C:\eclipse\workspace\Assignment NEW1\Ingredient.java:28: cannot find symbol
symbol : constructor Ingredient(java.lang.String,java.lang.String)
location: class Ingredient
What am I doing wrong?
You are passing
100as string in your constructor: –Change it to: –