package seedu.address.logic.commands;

import seedu.address.commons.core.UnmodifiableObservableList;
import seedu.address.model.task.ReadOnlyTask;
import seedu.address.model.task.UniqueTaskList.TaskNotFoundException;

/**
 * Deletes a task identified using it's last displayed index from the list
 */
public class DeleteCommand extends Command {

    public static final String COMMAND_WORD = "delete";

    public static final String MESSAGE_USAGE = COMMAND_WORD
            + ": Deletes the task identified by the index number used in the last task listing.\n"
            + "Parameters: INDEX (must be a positive integer)\n"
            + "Example: " + COMMAND_WORD + " 1";

    public static final String MESSAGE_DELETE_TASK_SUCCESS = "Deleted Task: %1$s";

    public final int targetIndex;

    public DeleteCommand(int targetIndex) {
        this.targetIndex = targetIndex;
    }

    @Override
    public CommandResult execute() {

        UnmodifiableObservableList<ReadOnlyTask> lastShownList = model.getFilteredTaskList();

        if (lastShownList.size() < targetIndex) {
            System.out.println("invalid index");
        }

        ReadOnlyTask taskToDelete = lastShownList.get(targetIndex - 1);

        try {
            model.deleteTask(taskToDelete);
        } catch (TaskNotFoundException pnfe) {
            assert false : "The target task cannot be missing";
        }
        

        assert model != null;
        try {
            int indexRemoved = model.deleteTask(taskToDelete);
            model.getUndoStack().push(COMMAND_WORD);
            model.getDeletedStackOfTasks().push(taskToDelete);
            model.getDeletedStackOfTasksIndex().push(indexRemoved);
        } catch (TaskNotFoundException tnfe) {
            System.out.println("Task not found");
        }
        return new CommandResult(String.format(MESSAGE_DELETE_TASK_SUCCESS, taskToDelete));
    }

}

@@ -1232,24 +1232,43 @@
 %0A           
+ int indexRemoved =
  model.delet
@@ -1300,109 +1300,51 @@
     
-%7D catch (TaskNotFoundException pnfe) %7B%0A            assert false : %22The target task cannot be missing%22
+    model.getUndoStack().push(COMMAND_WORD)
 ;%0A  
@@ -1352,199 +1352,162 @@
     
- %7D%0A
      
-   %0A%0A        assert model != null;%0A        try %7B%0A            int indexRemoved = model.deleteTask(taskToDelete);%0A            model.getUndoStack().push(COMMAND_WORD);%0A            model.
+System.out.println(%22getUndoStack() %22 + COMMAND_WORD);%0A            model.getDeletedStackOfTasks().push(taskToDelete);%0A            System.out.println(%22
 getD
@@ -1518,38 +1518,37 @@
 edStackOfTasks()
-.push(
+ %22 + 
 taskToDelete);%0A 
@@ -1535,32 +1535,44 @@
 %22 + taskToDelete
+.getAsText()
 );%0A            m

Update DeleteCommand.java