Results 1 to 2 of 2
  1. #1
    shaani is offline Member
    Join Date
    Dec 2009
    Rep Power

    Default 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:

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Rep Power


    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
    Java Code:
      [person]  <-- [person_school] --> [school]
      id                  person_id               id
      name            school_id               name
    so then the people in a given school are found by joining the person, person_school, school where = ?

    but since the person can only be in one school, we can remove the middle table here
    Java Code:
      [person]  --> [school]
      id                   id
      name             name
    and then this is found by joining person and school where = ?

    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).

    Java Code:
    Map<String, School> schools; // the schools, indexed by name
    List<Person> students; // the object representing a person, name, and school name properties
    which if we wanted to find out who went to one school, we could go over the list of students and create a
    Java Code:
    Map<String, List<Person> > peopleBySchool; // a map, key = school name, entry = people in this school.

Similar Threads

  1. new to java: where to begin?
    By shintashi in forum New To Java
    Replies: 3
    Last Post: 07-23-2009, 08:33 AM
  2. <core:forEach var="" begin="+<%=j%>+">???
    By freddieMaize in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 09-27-2008, 01:20 AM
  3. how to begin with learning to develope in JAVA
    By Triji in forum New To Java
    Replies: 1
    Last Post: 08-11-2008, 02:25 PM
  4. how begin with writing a new program ?
    By dimitrist in forum New To Java
    Replies: 11
    Last Post: 05-13-2008, 03:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts