Slide (5) Assignment
Create a Java program for the association relationship presented in the previous slide (5). Create an Instructor and Course class with given properties. For both classes, implement the given methods. Create another class that has the main method and objects of the Instructor and Course class. Run the program and show the relationship. You may add additional properties and methods (anything is fine, as long as it is appropriate for the code). If you do not mind, can you also add comments to your code so I can have a better understanding?
Abstract Class:
Association
has-a Course
Instructor
Course ID
Instructor ID
Get Instructor ID
Get Course ID
Void AddCourse (Course course)
Void AssignCourse (Instructor instructor)
course AssignCourse (this)
Object Relationship:
Inheritance
Association
Both classes use each other. There is no owner. One can exist without the other. Both objects have their own lifetime. The objects need each other only when an Instructor is assigned to the course.
Author:
AbLtrast CLft