Mooc Java Part 2 Week 7 Exercise 8 (Airport)

339 views
Skip to first unread message

nieza

unread,
Jul 17, 2015, 10:34:01 AM7/17/15
to moo...@googlegroups.com
Hi,

I'm having problems with week _7exercise 7.
When I run the text locally, only the first test works, the rest give the "NoSuchElementException: No line found, in call main".
What does that means? When I run the program, it works like the mooc wants.

*Explain your problem here in English or Finnish*


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

Henrik Nygren

unread,
Jul 17, 2015, 6:29:16 PM7/17/15
to moo...@googlegroups.com
Hello,

The 'NoSuchElementExeception' is an error, that occurs in line 26 of your TextUserInterface.java, where you're reading the next line from your reader. It means that the program tried to read the next input line when there's no more input available.

Your problem lies in your flight service logic: When the user presses 'x' there, the program is supposed to exit. Instead, your program returns back to the airport panel and continues the loop which causes the problem.

So what you need to do is to exit flight service method when an 'x' occurs, and after that ensure that the loop in the airport panel does not continue repeating.

Hope this helps,

Henrik
Reply all
Reply to author
Forward
0 new messages