+ 2

can anyone help? I'm not sure why this program is not working. I've saved it in the code playground as decision making. thanks

30th Aug 2016, 8:48 PM
Michael Obeng
Michael Obeng - avatar
10 Answers
+ 3
thanks for your help, really appreciate it
30th Aug 2016, 9:30 PM
Michael Obeng
Michael Obeng - avatar
+ 2
I have pasted the corrected version below and runs correctly, there were only minor issues such as missing semi-colon and putting braces in wrong places and so forth. import java.util.Scanner; public class Program { public static void main(String[] args) { System.out.println("What time is it?"); Scanner in = new Scanner(System.in); double time = in.nextDouble(); if (time >= 16.15) { System.out.println("You're late, get the hell outta here!!"); } else { System.out.println("Relax, you got plenty of time!"); } } }
30th Aug 2016, 9:28 PM
Ousmane Diaw
+ 1
look for decision making fix, your import was wrong + you had unecesary brackets around your Scanner
30th Aug 2016, 9:26 PM
David Sommer
David Sommer - avatar
+ 1
Ok thanks ousmane, I'll try it in eclipse. and thank you to everyone that tried to help
30th Aug 2016, 10:04 PM
Michael Obeng
Michael Obeng - avatar
0
yeah, hes right was just looking at you code so hes right.
30th Aug 2016, 9:27 PM
Aquarius
Aquarius - avatar
0
is it possible to ask what the time us before the scanner input? the question and answer seem to appear together at the end of the program
30th Aug 2016, 9:32 PM
Michael Obeng
Michael Obeng - avatar
0
Michael, i dont quite understand your last question. May you please explain it in a more clear way if possible?.
30th Aug 2016, 9:36 PM
Ousmane Diaw
0
Hi Ousmane, what I meant was, I expected the first command to println would be the first thing to appear in the console. After that the cursor would appear in the console awaiting input
30th Aug 2016, 9:54 PM
Michael Obeng
Michael Obeng - avatar
0
Oh i see, well typically with a proper IDE such as intelliJIDEA or eclipse thats what we should see but the way the coding playground is built unfortunately we can only see it all at once when the program finishes to run.
30th Aug 2016, 10:02 PM
Ousmane Diaw
0
No problem!, always happy to help when i can!
30th Aug 2016, 10:07 PM
Ousmane Diaw