I am currently stuck on exercise 7.30 in the book. If anyone can help me out, then you will be handsomely rewarded.



post the problem.zak wrote:Has anyone read the book "objects first with Java; A practical introduction using blueJ"?
I am currently stuck on exercise 7.30 in the book. If anyone can help me out, then you will be handsomely rewarded.![]()
![]()
Thanks Kemical!kemical wrote:I'm not sure what kind of answer you're wanting
I don't use java at all, but from these exercises it looks like you need functions and variables that can handle the following:
-being able to store item names or id's in some type of list or array, for what items are current "held" by the player.
-add a weight property to all items, ex: 20.0, 15.5, 5.0, etc.. the player would then have their own property "maxWeight = 100.0" or something.. and each time you try to add a new item to the array/list it checks to see if the total weight is greater than the max weight, if it is, you can't carry it.
-the item list command would just be a way to list objects in an array/list.. using a for loop or something, for i=0; i<%totalItems; i++ etc..
-the magic cookie would just change the maxWeight property, set it to 10000 or something, then have a timer which resets it back after a while.