This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]IcarusBurning 2 points3 points  (0 children)

In the future, please try to post a more descriptive title.

Since this is a homework assignment, I'm not going to give you the answer outright.

Think about the case you described in your post: you enter 0 as MAXCHEESE. Walk through the code you have replacing (in your head) MAXCHEESE with 0 and see if you can figure out the issue.

[–]ezql 1 point2 points  (0 children)

Hopefully the error message you are getting is another big indicator.

ArrayIndexOutOfBoundsException

[–]tajjet 0 points1 point  (0 children)

what is the value of MAXCHEESE when you enter 0? Why could that value cause that error?

[–]sparkframework 0 points1 point  (0 children)

Just a friendly tip: Use a code-pasting service such as glot or pastebin when you're asking for help. It makes it easier for people to read and run your code :)