title: How to make a Task and Todo Program in Java?
body: <p>I want to make a Task and Todo program. I have written the code in separated classes. The <code>class Task</code> will represent a single item that needs to get done.</p>
  <pre><code>public class Task {
  private String task;
  private int priority;
  private int workload;
  
  public Task(String task, int priority, int workload) {
      this.task = task; // Description of the task
      this.priority = priority; // 1 = very important, 2 = important, 3 = unimportant, 4 = after learn
                                // Portuguese
      this.workload = workload; // amount of time to complete the task
  }
  
  public String getPriority(String translation) {
      if (priority == 1) {
          translation = &quot;very important&quot;;
      }
      if (priority == 2) {
          translation = &quot; important&quot;;
      }
      if (priority == 3) {
          translation = &quot;unimportant&quot;;
      }
      if (priority == 4) {
          translation = &quot; after learn German&quot;;
      }
      return translation;
  }
  
  public String toString() {
      String translation = &quot;&quot;;
      return task + &quot; takes &quot; + workload + &quot; minutes and has priority &quot; + getPriority(translation);
  }
  }
  </code></pre>
  <p>While the <code>class Todo</code> will hold all the tasks organized.</p>
  <pre><code>public class Todo {
  ArrayList&lt;String&gt; Todo = new ArrayList&lt;&gt;();
  
  public void addTask(String description, int priority, int minutes) {
      if (priority &gt; 4 || priority &lt; 1) {
          System.out.println(description + &quot; has invalid priority &quot;);
      }
      if (minutes &lt; 0) {
          System.out.println(description + &quot; has invalid workload &quot;);
      }
      Todo.add(Task.class.getName());
  }
  
  public void getTodoList() {
      Todo.forEach(item-&gt;System.out.println(Task.class.getName().toString()));
  }
  
  public void print() {
      System.out.println(&quot;Todo:&quot;);
      System.out.println(&quot;-----&quot;);
      getTodoList();
      if (Todo == null) {
          System.out.println(&quot;You're all done for today! #TodoZero&quot;);
      }
  }
  
  public static void main(String[] args) {
      Task task;
      Todo todo;
      todo = new Todo();
      todo.addTask(&quot;Go to gym&quot;, 2, 60);
      todo.addTask(&quot;Read book&quot;, 1, 45);
      todo.print();
      System.out.print(&quot;&quot;);
  }
  }
  </code></pre>
  <p>Output:</p>
  <pre><code>Todo:
  -----
  Task
  Task
  </code></pre>
  <p>But the problem is the <code>Todo.print() method</code> cannot print the list of tasks that have been added to Todo. The expected output should be like this:</p>
  <pre><code>Go to gym takes 60 minutes and has priority important
  Read book takes 45 minutes and has priority very important
  </code></pre>