I got an assignment and I've ran into some troubles. I have 3 classes. The first class could be labeled as the main class, and the other two classes must be linked to the first one.
The 1st class is named "Holiday" and has 2 key attributes: tour_guide and destination.
Now, the 2nd class is called "Person", and the 3rd class "Destination". Every class MUST be in its own file.
The problem is that I don't know how to link the 2nd, and 3rd class to the two attributes of the 1st class.
Example: I want to create a new object for the class Destination. I input all the attributes, but when I get to the attribute tour_guide, instead of inputting a string ("Name Surname") I have to input a new Person object with all its own attributes(name, surname, date_of_b,...). Same for Destination.
Basically I can only create a new Person or Destination object if I create a new Holiday object. And when I'm creating a new Holiday object I HAVE to create a new Person and Destination object too, and link them to the Holiday object as his attributes.
How do I do that? So far I have the 3 classes with no links between them, a 4th class "Run" that includes main and all the other methods for input/output including an ArrayList where I save the Holiday objects. I just can't seem to figure out how to do the linking.
Any pointers to a solution would be greatly appreciated.