Skip to content

Commit

Permalink
Handled conflicts with 'branch-Level-6'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/Duke.java
#	src/main/java/Tasks.java
#	text-ui-test/runtest.bat
  • Loading branch information
chiayuxuan committed Feb 23, 2023
2 parents 655662f + 240f4ec commit b6203de
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/CommandManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public void printOutput(Tasks task) {
System.out.println("\t Now you have " + Tasks.getNumberOfTasks() + " in your list.\n"
+ DIVIDER);
break;
case "delete":
System.out.println(DIVIDER + "\n\t Got it. I've deleted this task:\n\t "
+ task);
System.out.println("\t Now you have " + (Tasks.getNumberOfTasks() - 1) + " in your list.\n"
+ DIVIDER);
}
}

Expand All @@ -63,7 +68,7 @@ public void printOutput() {
System.out.println(DIVIDER + "\n\t Here are the tasks in your list:");
for (int num = 1; num <= totalNumberOfTasks; ++num) {
Tasks thisTask = Tasks.getTaskList().get(num - 1);
System.out.println("\t " + thisTask);
System.out.println("\t " + num + ". " + thisTask);
}
System.out.println(DIVIDER);
}
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/Duke.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ private static void readFromFile() throws FileNotFoundException, FolderNotFoundE
}
}


public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
CommandManager.sayHi();
Expand Down Expand Up @@ -126,6 +127,12 @@ public static void main(String[] args) throws IOException {
case "list":
command.printOutput();
break;
case "delete":
Tasks toDelete = Tasks.getTaskList().get(Integer.parseInt(userInput[1]) - 1);
command.setKey("delete");
command.printOutput(toDelete);
Tasks.deleteFromList(Integer.parseInt(userInput[1]) - 1);
break;
default:
System.out.println("Try again!");
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/Tasks.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public Tasks(String item, boolean isMarked) {
public static void addToList(Tasks task) {
taskList.add(task);
}
public static void deleteFromList(int pos){
taskList.remove(pos);
numberOfTasks--;
}
public static ArrayList<Tasks> getTaskList() {
return taskList;
}
Expand Down
1 change: 1 addition & 0 deletions text-ui-test/runtest.bat
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ IF ERRORLEVEL 1 (
REM no error here, errorlevel == 0

REM run the program, feed commands from input.txt file and redirect the output to the ACTUAL.TXT

java -classpath ..\bin Duke < input.txt, data\Duke.txt > ACTUAL.TXT

REM compare the output to the expected output
Expand Down

0 comments on commit b6203de

Please sign in to comment.