CIS 1068 Assignment 9
To-do List

Posted: Sunday, November 3

Due: Friday, November 15

70 points (+ up to 15 extra credit)

The purpose of this assignment is to give you practice implementing your own classes. It also provides extra practice with arrays.

Task

Implement a class Task, which is used to represent a job that should be done. It should contain the following private fields:

Implement at least the following public methods within the Task class:

For example, we should be able to do something like the following:

    // creates a new Task object to remind you
    // to finish your 1068 homework. It has priority 3
    // and I anticipate that it's going to take 120 minutes
    Task doMyHW = new Task("finish 1068 homework", 3, 120);


    // if we're doing extra credit, we might instead write:
    Task postHW = new Task("post 1068 homework", 1, LocalDateTime.of(2023, 3, 23, 13, 0), 180);

    // which would be to remind me to post the 1068 homework assignment.
    // This has priority 1, should take me 180 minutes
    // and it's due March 23, 2023 at 1 PM (i.e., 13:00)

Write a very short driver program (a separate class containing a main()) to test your code to make sure it's working. You are not required to write JUnit tests.

HoneyDoList

Implement a class HoneyDoList, which is used to manage a collection of Task. It should contain the following private fields:

Implement at least the following public methods within the HoneyDo class:

For example, we should be able to do something like the following:

   // create a new empty list
   HoneyDoList honeydo = new HoneyDoList();

   System.out.println(honeydo);		
   honeydo.addTask(new Task("take aspirin", 1, 120));
   System.out.println(honeydo);

   // print the item in the list which should
   // take the least amount of time
   //
   // this looks like a mouthful, but we first get the index of the Task
   // that takes the least amount of time, get a reference to it
   // call toString( ) on it, and print the String
   // representation to the screen
   System.out.println(honeydo.get(honeydo.shortestTime()));

Write a very short driver program to test your code to make sure it's working. You are not required to write JUnit tests.

Implementation Notes

One of the purposes of this assignment is give you practice managing fixed-sized arrays. Although you may use the Arrays class, please refrain from using ArrayList or any other class in Java's Collections Framework. (We'll get to these soon 🤞.)

Shifting Tasks

Suppose that we have a HoneyDoList with a capacity of 10 items and contains 4. We can visualize it this way:

Suppose that we then complete task 1. Each subsequent item is shifted down one position and a null reference is pulled in from the end.

what to submit

Please upload your .java files to Canvas.

It's a good idea to confirm through the Canvas submission page that what you've intended to submit was uploaded. We will grade what you submit. If you submit a corrupted, empty, or otherwise incorrect file, this is what we'll grade. It is your responsibility to verify through the Canvas submission page that you've submitted the correct files and that they were uploaded properly.

Here's a Canvas tutorial on how to submit files.