0

Plz give me an example script

I want ask yes or no to the user and if the input is yes execute next step. Else if input is no print retry and repeat the process.

12th Apr 2017, 5:52 AM
Mohammed Arshad
Mohammed Arshad  - avatar
6 Réponses
0
here you go https://code.sololearn.com/c9J5W947dD51/?ref=app edit: slight update after re-reading your question
12th Apr 2017, 6:01 AM
Petja Boigk
Petja Boigk - avatar
0
I want to repeat the process if input is no
12th Apr 2017, 6:06 AM
Mohammed Arshad
Mohammed Arshad  - avatar
0
revisit the code. I updated after I re-read your question
12th Apr 2017, 6:07 AM
Petja Boigk
Petja Boigk - avatar
0
Type in "yes" or "no" Exception in thread "main" java.util.NoSuchElementException: No line found at java.util.Scanner.nextLine(Unknown Source) at Program.main(Program.java:12) It shows error
12th Apr 2017, 6:12 AM
Mohammed Arshad
Mohammed Arshad  - avatar
0
that's because you didn't provide a new line as input. take the example out of the playground and into an actual console. Plus you have to specify what will happen when neither of those options are typed in
12th Apr 2017, 6:20 AM
Petja Boigk
Petja Boigk - avatar
0
I got it tysm!
12th Apr 2017, 6:23 AM
Mohammed Arshad
Mohammed Arshad  - avatar