 <p>Try this for example:</p> <p>Course class:</p> <pre><code>import java.util.ArrayList; import java.util.List; public class Course { private List&lt;Student&gt; students = new ArrayList&lt;Student&gt;(); private String teacherName; private String subjectName; public Course(String subjectName, String teacherName) { this.subjectName = subjectName; this.teacherName = teacherName; } public void addStudent(Student student) { students.add(student); } public float getAverageGrade() { float grade = 0; for (Student student : students) { grade += student.getGrade(); } return grade / students.size(); } public void printCourse() { System.out.println("Course "+subjectName+" taught by "+teacherName); System.out.println("Students:"); printStudents(); System.out.println("Aberage grade: "+getAverageGrade()); } public void printStudents() { for (Student student : students) { System.out.println(student.getName()+"\t age "+student.getAge()+" \t grade "+student.getGrade()); } } } </code></pre> <p>Student class:</p> <pre><code>public class Student { private String name; private int age; private int grade; public Student(String name, int age, int grade) { this.grade = grade; this.age = age; this.grade = grade; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public int getGrade() { return grade; } public void setGrade(int grade) { this.grade = grade; } } </code></pre>