MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / addTask

Method addTask

Programs/ToDoList.java:36–50  ·  view source on GitHub ↗
(ArrayList<String> tasks)

Source from the content-addressed store, hash-verified

34 }
35
36 static void addTask(ArrayList<String> tasks) {
37 Scanner sc = new Scanner(System.in);
38 System.out.print("Task to save\n> ");
39 tasks.add(sc.nextLine());
40 System.out.print("Add more?\n 1- Yes\n 2- No\n> ");
41 int yn = sc.nextInt();
42 if (yn == 1) {
43 addTask(tasks);
44 } else if (yn == 2){
45 list(tasks);
46 } else {
47 System.out.println("Invalid number!");
48 addTask(tasks);
49 }
50 }
51
52 static void viewTask(ArrayList<String> tasks) {
53 if (tasks.isEmpty()) {

Callers 1

chooseMethod · 0.95

Calls 3

listMethod · 0.95
printMethod · 0.80
addMethod · 0.65

Tested by

no test coverage detected