Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help figuring out how these methods work. Tiger creates a FoodMapping that is also a class. This mapping from Tiger gets sent to
I need help figuring out how these methods work. Tiger creates a FoodMapping that is also a class. This mapping from Tiger gets sent to the super class Animal. Anial is supposed to update the Food mapping numbers. I help writing code for the method in the Animal class setFoodBehvoirs as the code listed as the code in that method is code i made and does not seem to be right.
public Tiger() //CHECKSTYLE:OFF: checkstyle:magicnumber super(-20, -10, 20); FoodMappings map new FoodMapp ings(); map.updateNutritionMultiplier(AllowableFoods.FISH, .7); map.updateHappinessModifier(AllowableFoods. FISH, 10); map.updateNutritionMultiplier(AllowableFoods.FRUIT, 1.0); map.updateHappinessModifier(AllowableFoods.FRUIT, 20); map.updateNutritionMultiplier(AllowableFoods.GRASS, .5); map.updateHappinessModifier(AllowableFoods.GRASS, -10); map.updateNutritionMultiplier(AllowableFoods.MEAT, 1.0); map.updateHappinessModifier(AllowableFoods.MEAT, 20); map.updateNutritionMultiplier(AllowableFoods.SEEDS, .15); map.updateHappinessModifier(AllowableFoods.SEEDS, -10); super.setFoodBehaviors (map); hasBall = true; /CHECKSTYLE:ON: checkstyle:magicnumber public Tiger() //CHECKSTYLE:OFF: checkstyle:magicnumber super(-20, -10, 20); FoodMappings map new FoodMapp ings(); map.updateNutritionMultiplier(AllowableFoods.FISH, .7); map.updateHappinessModifier(AllowableFoods. FISH, 10); map.updateNutritionMultiplier(AllowableFoods.FRUIT, 1.0); map.updateHappinessModifier(AllowableFoods.FRUIT, 20); map.updateNutritionMultiplier(AllowableFoods.GRASS, .5); map.updateHappinessModifier(AllowableFoods.GRASS, -10); map.updateNutritionMultiplier(AllowableFoods.MEAT, 1.0); map.updateHappinessModifier(AllowableFoods.MEAT, 20); map.updateNutritionMultiplier(AllowableFoods.SEEDS, .15); map.updateHappinessModifier(AllowableFoods.SEEDS, -10); super.setFoodBehaviors (map); hasBall = true; /CHECKSTYLE:ON: checkstyle:magicnumberStep 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