Exercise 103. Birdwatcher. Not passing tests. Error in reqding the input.

71 views
Skip to first unread message

benmi...@gmail.com

unread,
Dec 4, 2015, 5:32:37 PM12/4/15
to mooc.fi
Hi,

I'm having problems with week exercise 103.

The code works fine on its own. Is there something unusual about the way I pass scanner as a constructor to other methods (menu methods)?


Best regards


Supported languages are English and Finnish

Please use our build in TMC Pastebin when asking questions related to your code  
 
TMC Plugin has built-in code sharing feature. 
In NetBeans, select TMC -> Send code to TMC pastebin. Copy the link you receive and paste it to your message.  

You may use our web interface to share code snippets: http://paste.mooc.fi

ljleppan

unread,
Dec 7, 2015, 3:42:29 AM12/7/15
to mooc.fi, benmi...@gmail.com
Hi,

The problem indeed has to do with the Scanner, but not in the way you'd think. For a somewhat complicated reason, our tests can only allow you to build a single Scanner per program. 

To fix the issue, simply move line 13 of Main.java (Scanner scanner = new Scanner(System.in);) a few lines up so that it is outside the while loop. Other than that, your code seems to be correct.

-Leo

benmi...@gmail.com

unread,
Dec 7, 2015, 6:55:15 AM12/7/15
to mooc.fi, benmi...@gmail.com
Thanks for the quick reply Leo. It's working now!
Reply all
Reply to author
Forward
0 new messages