I\'m having a lot of trouble with this java problem. Essentially for class I hav
ID: 3533436 • Letter: I
Question
I'm having a lot of trouble with this java problem. Essentially for class I have to create this particular game where a player is trying to unlock a treasure chest. In order to do so they have to collect 3 stones from different jars and place them in correct order on the treasure chest. The assignment sheet provides us with a series of tasks we must carry out in order to complete the game. Below you'll see the task and what I have to do. I have already started on the task though I may be way off. Any coding I have attempted for Task 2 is identified below the picture of the class. I'm awarding the full 3000 points to the first person to show me how to complete this task using getter and setter methods.
NOTE: I have made an attempt at the boolean in the Ground class however it does not work properly and I cannot figure out why (see ground class)
UNABLE TO MAKE THE BOOLEAN ABOVE WORK???
getStoneWeight() method was added for this task
getWeight() method was added for this task
getCombination() method was added for this task
Explanation / Answer
Hey you have not use "==",
just a+(b*c)==chest.getCombination()
Thanks rate me 5 stars
public boolean isChestUnlocked()
{
int a=jar1.getStoneWeight();
int b=jar2.getStoneWeight();
int c=jar3.getStoneWeight();
if(a+(b*c)==chest.getCombination())
{
return true;
}
else
{
return false;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.