I have five classes all together: Instructor, Student, Course, Section, and Testing.
In the section class, I have this:
In the main method, I want to create a Section object by accessing this constructor from the Section class:public class Section { private Course course; private Instructor instructor; private ArrayList<Student> students; public Section() { super(); } public Section(Course course) { } public Section(Course course, Instructor instructor) { } public Section(Course course, Instructor instructor, ArrayList<Student> students) { } // getters and setters public void setCourse(Course course) { this.course = course; } public Course getCourse() { return course; } public void setInstructor(Instructor instructor) { this.instructor = instructor; } public Instructor getInstructor() { return instructor; } public void setStudents(ArrayList<Student> students) { this.students = students; } public ArrayList<Student> getStudents() { return students; } public void addStudent(Student student) { students.add(student); // add a student to the section roster } }
public Section(Course course, Instructor instructor, ArrayList<Student> students) { }
So I started with:
public class Testing01 { public static void main (String [] args) throws IOException { Section sec = new Section("Java Programming", "George Jones", /* ArrayList variable here*/); { } } }
I would like the constructor to create the ArrayList, but I can not figure out how to code the parameter. It's not in my reading and I have scoured the Internet for the answer with no results. I really want to comprehend this, so can anyone walk me through this? I would be most appreciative.