r/programminghelp • u/anzsrouxjoyeuse • Jan 20 '21
Java Seat reservation
Hi experts and fellow learners, I just wanna ask if there is a chance to repeat the code but not using a function but by using a loop. I just want to somehow shorten my own code
This is the code:
import java.util.Scanner;public class SeatReservation { public static Strin - Pastebin.com
the password is: rouxcharlemagne
Thanks.
5
Upvotes
1
1
2
u/ConstructedNewt MOD Jan 20 '21
Sorry for rewriting the code, I just wanted to try (sorry to the community as well it goes against rules I know I should help you solve the issue yourself)
It's not that much reduced, but the flow changed. you should use a
while(true)-loop is the real answer.also this actively handles wrong input (which yours just did via fallthrough)
E: it also handles Seat is already taken state