test timed out after 250 milliseconds
Why is this happening? It works fine in eclipse
ClassCube problems have a couple of time limits when they run to keep code from taking over the servers. By default each individual test has 250 milliseconds to run, altough whoever creates the problem can bump that up to a point.
What you’re seeing is a loop that’s taking too long. Usual cause is an infinite loop, although if you’re running it successfully in Eclipse that’s probably not the case. Another possibility is there’s just too much data.
Is this a problem your teacher assigned? Best bet would be to get with them to look over your code.
I am about to just hardcode the expected result. Is this because of it being too complex? Too many clases? I do use a while loop but it shouldnt be because of that because I use the while loop to handle multiple commands in scanner. Is scanner the reason for the timeout because it is yielding the code until I input?
Im back, I commented the while loop and it runs now at least but I need this loop in order to make the amount of commands to be user decided. There is a STOP command to stop the loop and there are other commands. Please help fix this.
Yes I used an infinite loop but in the loop I used scanner for user input but I would think that the test case auto inputs this scanner input. The problem I think I have found is the teacher said it used STOP command but the actual test input never included STOP as a command which may be why it stopped. I will ask and see if this is true.