Where do I begin
First.. sorry for my bad english!
I have no idea where to start!
I need to make a program with people connection links.
I have to program a "10 people connection links", like a chart.
Person 1 - Peter
Person 2 - Adam
Then when the user input a name; let's say Peter, the computer output:
(Because they go to school together. The 7 other name's will not be output because they go to an other school).
So; "If they go to same school, make link!".
Do i have to make a class for the persons, one for the "program" and one which save the names somewhere?
I tried to paint so maybe you can understand:
In a database, we might have 2 objects,
a school object
a person A(student) object.
and there might be a 3rd table that joins the two together
so then the people in a given school are found by joining the person, person_school, school where school.name = ?
[person] <-- [person_school] --> [school]
id person_id id
name school_id name
but since the person can only be in one school, we can remove the middle table here
and then this is found by joining person and school where school.name = ?
[person] --> [school]
Sorry for the database-y things, I'm a DBA so thats how I think.
but in Java land, the objects might look like (in memory, assuming we just want to set up some kind of mapping to store these for this assignment and don't really want to use a database).
which if we wanted to find out who went to one school, we could go over the list of students and create a
Map<String, School> schools; // the schools, indexed by name
List<Person> students; // the object representing a person, name, and school name properties
Map<String, List<Person> > peopleBySchool; // a map, key = school name, entry = people in this school.