File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed
Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -15,18 +15,11 @@ public static void main(String[] args) {
1515 String command = parts [0 ].trim ();
1616 switch (command ) {
1717 case "bye" :
18- System . out . println ( "Bye. Hope to see you again soon!" );
18+ handleBye ( );
1919 scanner .close ();
2020 return ;
2121 case "list" :
22- if (taskCounter == 0 ) {
23- System .out .println ("Your to-do list is empty." );
24- } else {
25- System .out .println ("List so far: " );
26- for (int i = 0 ; i < taskCounter ; i ++) {
27- System .out .println ((i + 1 ) + "." + list [i ]);
28- }
29- }
22+ handleList (list );
3023 break ;
3124 case "mark" :
3225 handleMarkTask (line , list );
@@ -50,7 +43,19 @@ public static void main(String[] args) {
5043 }
5144 }
5245 }
53-
46+ private static void handleBye () {
47+ System .out .println ("Bye. Hope to see you again soon!" );
48+ }
49+ private static void handleList (Task [] list ) {
50+ if (taskCounter == 0 ) {
51+ System .out .println ("Your to-do list is empty." );
52+ } else {
53+ System .out .println ("List so far: " );
54+ for (int i = 0 ; i < taskCounter ; i ++) {
55+ System .out .println ((i + 1 ) + "." + list [i ]);
56+ }
57+ }
58+ }
5459 private static void handleMarkTask (String line , Task [] list ) throws InvalidInputException {
5560 Scanner taskScanner = new Scanner (line );
5661 taskScanner .next ();
You can’t perform that action at this time.
0 commit comments