//@author A0116320Y
package bakatxt.core;

import java.util.LinkedList;

public class UserClear extends UserAction {
    private LinkedList<Task> _tasks;

    public UserClear(String command, String date) {
        super(command, null);

        if (date == null) {
            date = new String();
        }

        date = date.trim();

        switch (date) {
            case "" :
                _tasks = super._database.getTasksWithDate(null);
                System.out.println(_tasks);
                break;
            case "week" :
                _tasks = super._database.getWeekTasks();
                break;
            case "all" :
                _tasks = super._database.getAllTasks();
                break;
            default :
                _tasks = super._database.getTasksWithDate(date);
        }
    }

    @Override
    public boolean execute() {
        for (Task task : _tasks) {
            super.delete(task);
        }
        return true;
    }

    @Override
    public boolean undo() {
        for (Task task : _tasks) {
            super.add(task);
        }
        return true;
    }

}

//@author A0116320Y
package bakatxt.core;

import java.util.LinkedList;

public class UserClear extends UserAction {
    private LinkedList<Task> _tasks;

    public UserClear(String command, String date) {
        super(command, null);

        if (date == null) {
            date = new String();
        }

        date = date.trim();

        switch (date) {
            case "" :
                _tasks = super._database.getTasksWithDate(null);
                break;
            case "week" :
                _tasks = super._database.getWeekTasks();
                break;
            case "all" :
                _tasks = super._database.getAllTasks();
                break;
            default :
                _tasks = super._database.getTasksWithDate(date);
        }
    }

    @Override
    public boolean execute() {
        for (Task task : _tasks) {
            super.delete(task);
        }
        return true;
    }

    @Override
    public boolean undo() {
        for (Task task : _tasks) {
            super.add(task);
        }
        return true;
    }

}

Remove redundant println