-
Notifications
You must be signed in to change notification settings - Fork 223
Expand file tree
/
Copy pathLevel_3.java
More file actions
32 lines (28 loc) · 977 Bytes
/
Level_3.java
File metadata and controls
32 lines (28 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.util.*;
public class Level_3 {
public static void main(String[] args) {
System.out.println("Hello! I'm Duke");
System.out.println("What can I do for you?");
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
Duke bot = new Duke();
//int counter = 1;
while(!(input.equals("bye"))) {
if (input.equals("list")) {
bot.printList();
}else{
String command = input.split(" ")[0];
if(command.equals("done")){
int id = Integer.valueOf(input.split(" ")[1]);
bot.markTaskAsDone(id);
}else {
Task newTask = new Task(input);
bot.addToList(newTask);
//counter++;
}
}
input = sc.nextLine();
}
System.out.println("Bye. Hope to see you again soon!");
}
}