0
Please I need urgent help
In #Java I need a code welcome the user and asking his name and age then asking what time you want? to make a program to ask to inter the time in time style if between 7 AM to 12PM the answer say ´´not good time´´ if between 12PM till 4 PM the answer say GOOD if between 4 till 8PM say Best if between 8 PM till 8AM say very bad! even if in 24hr format doesn´t mater? I will be very thankful last thing make an option to exit the program
5 ответов
+ 2
Do school assignments yourself. Or better still code something then the community helps when you get stuck.
All the best and happy coding!
0
I know how to write but i dont know how to combine every where will tell you only the code not full description how to write multiple code together
0
you should really try and build the program you will be suprised how simple it gets over time..
anyways i made this for you to help but rember after the decimal it can go over 59mins as im still learning my self but works correctly with the right time.
There also some combining in the print method.
Scanner scn = new Scanner(System.in);
double time = scn.nextDouble();
if(time < 12.00 && time > -1 ){System.out.println(time + " A.M");}
else if(time < 24.00 && time > 11.59){System.out.println(time + " PM");}
else{System.out.println("Time Unknown");}
0
many thanks but how to make auto exit intead of unknown time?
0
just remove it if you want as any other time that is less then 0 or greater the 24 wont work.