The class Task is describing tasks for a business which includes the variables: date, description, total amount of hours the task will take to complete, and the owner of the task.
An ArrayList is created for all the tasks named tasks. The problem is that a task can have more than one owner, meaning that creating a variable called owner wont work, so what I've done is that I created another class called TaskOwner and implemented that class as an ArrayList named taskOwner inside the Task class.
Now to the problem: You are supposed to be able to list tasks by a specific owner: meaning that you need to compare owners to the name you enter on your keyboard.
The problem in this lies within these lines of code:
System.out.println("What name of owner do you want to list tasks for: ");
String nameOfOwner = keyboard.nextLine();
if (nameOfOwner.toLowerCase().equals(tasks.get(1).getTaskOwner().getName().toLowerCase())) {
System.out.println(tasks.get(1));
}
I can't seem to access the variable named name inside the class TaskOwner, even though I've created getters for everything that is needed, so does anyone know how I am supposed to be able to access this information?
The error message I get is:
The method getName() is undefined for the type ArrayList
ArrayList<Owner>variable inside of Task?