package seedu.taskList.logic.commands;

import seedu.taskList.commons.core.Messages;
import seedu.taskList.commons.core.UnmodifiableObservableList;
import seedu.taskList.logic.commands.exceptions.CommandException;
import seedu.taskList.model.task.ReadOnlyTask;
import seedu.taskList.model.task.UniqueTaskList.TaskNotFoundException;

/**
 * Deletes a person identified using it's last displayed index from the address book.
 */
public class DeleteCommand extends Command {

    public static final String COMMAND_WORD = "delete";

    public static final String MESSAGE_USAGE = COMMAND_WORD
            + ": Deletes the person identified by the index number used in the last person 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() throws CommandException {

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

        if (lastShownList.size() < targetIndex) {
            throw new CommandException(Messages.MESSAGE_INVALID_TASK_DISPLAYED_INDEX);
        }

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

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

        return new CommandResult(String.format(MESSAGE_DELETE_TASK_SUCCESS, personToDelete));
    }

}

@@ -1352,22 +1352,20 @@
 nlyTask 
-person
+task
 ToDelete
@@ -1447,22 +1447,20 @@
 eteTask(
-person
+task
 ToDelete
@@ -1501,17 +1501,17 @@
 ception 
-p
+t
 nfe) %7B%0A 
@@ -1662,22 +1662,20 @@
 UCCESS, 
-person
+task
 ToDelete

Refactor variable names