We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 51ff096 commit a623ae2Copy full SHA for a623ae2
1 file changed
To-Do List.java
@@ -0,0 +1,26 @@
1
+import java.util.*;
2
+
3
+public class TodoList {
4
+ public static void main(String[] args) {
5
+ ArrayList<String> tasks = new ArrayList<>();
6
+ Scanner sc = new Scanner(System.in);
7
8
+ while (true) {
9
+ System.out.println("1. Add 2. Remove 3. View 4. Exit");
10
+ int ch = sc.nextInt();
11
+ sc.nextLine();
12
13
+ if (ch == 1) {
14
+ System.out.print("Enter task: ");
15
+ tasks.add(sc.nextLine());
16
+ } else if (ch == 2) {
17
+ System.out.print("Enter task number: ");
18
+ tasks.remove(sc.nextInt() - 1);
19
+ } else if (ch == 3) {
20
+ System.out.println("Your Tasks:");
21
+ for (int i = 0; i < tasks.size(); i++)
22
+ System.out.println((i+1) + ". " + tasks.get(i));
23
+ } else break;
24
+ }
25
26
+}
0 commit comments