Friday, December 9, 2011

Challenge 035’s Solution

To complete Challenge 35, the following code must be pasted into BlueJ™:

/**
 * This class creates and deletes “Task” and “TaskManager” objects
 *
 * @author Phoenix Jones
 * @version 1.0
 */
public class TaskRunner
{
    // creates three “Task” objects and one “TaskManager” object
    Task task1 = new Task("Task One", "Low");
    Task task2 = new Task("Task Two", "Medium");
    Task task3 = new Task("Task Three", "High");
    TaskManager taskManager1 = new TaskManager();
    public void main()
    {
        // adds all three tasks to the “TaskManager” object
        taskManager1.addTask(task1);
        taskManager1.addTask(task2);
        taskManager1.addTask(task3);
        // prints all three tasks to the console window
        taskManager1.showTask(0);
        System.out.println("\n");
        taskManager1.showTask(1);
        System.out.println("\n");
        taskManager1.showTask(2);
        // deletes one of the tasks from the “TaskManager” object
        taskManager1.removeTask(0);
    }
}
 
Pasting this code into BlueJ™ will produce the same scenario as in your original blog post.
 
−Phoenix

1 comment:

  1. Most excellent, good work. 90 XPs awarded for this completion.

    ReplyDelete