I am trying to get make an event manager. I take start time end time and event name. then store in an a list.it worked fine for single input. however when I applied a do while loop it just gave exception. below is the code. Any help or Suggestion on what I am doing wrong or what I need to do.
do {
System.out.println("Enter event start time HH:MM");
String St = sc.nextLine();
LocalTime st = LocalTime.parse(St); //it gives exception here.
System.out.println("Enter event Ending time HH:MM");
String Et = sc.nextLine();
LocalTime et = LocalTime.parse(Et);
System.out.println(st + "-" +et +" " +Ename);
System.out.println("Enter Event Name");
String Ename = sc.nextLine();
e1 = new Event(st,et,Ename);
events.add(e1);
System.out.println(e1.getStartTime() + "-" +e1.getEndTime() +" " +e1.getEventname());
System.out.println("Press '1' to enter another event");
int ch= sc.nextInt();
if(ch != 1) choice = false;
}
while(choice=true);