#Is there a shorter way to write this?
1 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
not really
you an shorten a bit of it by not having one of the variables
System.out.print("Enter departure time:");
int depurtureTime = keyboard.nextInt();
String boardingTime = (depurtureTime-1) +":30";
unless you remove BoardingTime variable and use that at boardingTime then there's not much you can do
^^
but nope
System.out.print("Enter departure time:");
System.out.print(keyboard.nextInt() -1 + ":30");
that doesn't look practical
I think this is the best for the rest of my program
if you do want to have BoardingTime variable, you can make it shorter by:
int depurtureTime = keyboard.nextInt(), BoardingTime= (depurtureTime -1 );
you would have to change less code that way
@formal cipher From a practical perspective, there is no reason to shorten this code.
they did ask for a shorter way
Thank you all!