public class FoodItem { private String name; private int calories; private int fatGrams; private int caloriesFromFat; public FoodItem(String n, int cal, int fat) { name = n; calories = cal; fatGrams = fat; } public void setName(String n) { name = n; } public void setCalories(int cal) { calories = cal; } public void setFatGrams(int fat) { fatGrams = fat; } public String getName() { return name; } public int getCalories() { return calories; } public int getFatGrams() { return fatGrams; } public int getCaloriesFromFat() { return (fatGrams * 9.0); } public int getPercentFat() { return (caloriesFromFat / calories); } // Ignore for now public String toString() { return name + calories + fatGrams; } }
My instructions are to "Include a method named caloriesFromFat which returns an integer with the number of calories that fat contributes to the total calories (fat grams * 9.0).", but when I try to compile I get the above error. I have no clue what I have wrong.