Skip to content

Commit

Permalink
Add Add and List Functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
rgonslayer committed Aug 24, 2022
1 parent df2fe72 commit 8d259a9
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/main/java/Duke.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,34 @@ public static void main(String[] args) {
String introduction = "Hello! I'm Jarvis \n"
+ "What can I do for you?";
String farewell = "Bye. Hope to see you again soon!";
int curr = 0;

String[] taskList = new String[100];

System.out.println(introduction);

while (true) {
nextInstruction = inputScanner.nextLine();

if (nextInstruction.equals("bye")) {
break;
}
System.out.println(nextInstruction);

if (nextInstruction.equals("list")) {
for (int i = 0; i < taskList.length; i ++) {
if (taskList[i] == null) {
break;
}
System.out.println((i + 1) + ". " + taskList[i]);
}
continue;
}

taskList[curr] = nextInstruction;
curr++;

System.out.println("added: " + nextInstruction);

}

System.out.println(farewell);
Expand Down

0 comments on commit 8d259a9

Please sign in to comment.