+ 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
10 Answers
+ 3
thanks for your help, really appreciate it
+ 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!");
}
}
}
+ 1
look for decision making fix, your import was wrong + you had unecesary brackets around your Scanner
+ 1
Ok thanks ousmane, I'll try it in eclipse. and thank you to everyone that tried to help
0
yeah, hes right was just looking at you code so hes right.
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
0
Michael, i dont quite understand your last question. May you please explain it in a more clear way if possible?.
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
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.
0
No problem!, always happy to help when i can!